FederationStateStoreTables.sql 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. USE [FederationStateStore]
  19. GO
  20. IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
  21. WHERE name = 'applicationsHomeSubCluster'
  22. AND schema_id = SCHEMA_ID('dbo'))
  23. BEGIN
  24. PRINT 'Table applicationsHomeSubCluster does not exist, create it...'
  25. SET ANSI_NULLS ON
  26. SET QUOTED_IDENTIFIER ON
  27. SET ANSI_PADDING ON
  28. CREATE TABLE [dbo].[applicationsHomeSubCluster](
  29. applicationId VARCHAR(64) COLLATE Latin1_General_100_BIN2 NOT NULL,
  30. homeSubCluster VARCHAR(256) NOT NULL,
  31. createTime DATETIME2 NOT NULL CONSTRAINT ts_createAppTime DEFAULT GETUTCDATE(),
  32. CONSTRAINT [pk_applicationId] PRIMARY KEY
  33. (
  34. [applicationId]
  35. )
  36. )
  37. SET ANSI_PADDING OFF
  38. PRINT 'Table applicationsHomeSubCluster created.'
  39. END
  40. ELSE
  41. PRINT 'Table applicationsHomeSubCluster exists, no operation required...'
  42. GO
  43. GO
  44. IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
  45. WHERE name = 'membership'
  46. AND schema_id = SCHEMA_ID('dbo'))
  47. BEGIN
  48. PRINT 'Table membership does not exist, create it...'
  49. SET ANSI_NULLS ON
  50. SET QUOTED_IDENTIFIER ON
  51. SET ANSI_PADDING ON
  52. CREATE TABLE [dbo].[membership](
  53. [subClusterId] VARCHAR(256) COLLATE Latin1_General_100_BIN2 NOT NULL,
  54. [amRMServiceAddress] VARCHAR(256) NOT NULL,
  55. [clientRMServiceAddress] VARCHAR(256) NOT NULL,
  56. [rmAdminServiceAddress] VARCHAR(256) NOT NULL,
  57. [rmWebServiceAddress] VARCHAR(256) NOT NULL,
  58. [lastHeartBeat] DATETIME2 NOT NULL,
  59. [state] VARCHAR(32) NOT NULL,
  60. [lastStartTime] BIGINT NOT NULL,
  61. [capability] VARCHAR(6000) NOT NULL,
  62. CONSTRAINT [pk_subClusterId] PRIMARY KEY
  63. (
  64. [subClusterId]
  65. )
  66. )
  67. SET ANSI_PADDING OFF
  68. PRINT 'Table membership created.'
  69. END
  70. ELSE
  71. PRINT 'Table membership exists, no operation required...'
  72. GO
  73. GO
  74. IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
  75. WHERE name = 'policies'
  76. AND schema_id = SCHEMA_ID('dbo'))
  77. BEGIN
  78. PRINT 'Table policies does not exist, create it...'
  79. SET ANSI_NULLS ON
  80. SET QUOTED_IDENTIFIER ON
  81. SET ANSI_PADDING ON
  82. CREATE TABLE [dbo].[policies](
  83. queue VARCHAR(256) COLLATE Latin1_General_100_BIN2 NOT NULL,
  84. policyType VARCHAR(256) NOT NULL,
  85. params VARBINARY(6000) NOT NULL,
  86. CONSTRAINT [pk_queue] PRIMARY KEY
  87. (
  88. [queue]
  89. )
  90. )
  91. SET ANSI_PADDING OFF
  92. PRINT 'Table policies created.'
  93. END
  94. ELSE
  95. PRINT 'Table policies exists, no operation required...'
  96. GO
  97. GO