FederationStateStoreTables.sql 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. CONSTRAINT [uc_lastStartTime] UNIQUE
  67. (
  68. [lastStartTime]
  69. )
  70. )
  71. SET ANSI_PADDING OFF
  72. PRINT 'Table membership created.'
  73. END
  74. ELSE
  75. PRINT 'Table membership exists, no operation required...'
  76. GO
  77. GO
  78. IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
  79. WHERE name = 'policies'
  80. AND schema_id = SCHEMA_ID('dbo'))
  81. BEGIN
  82. PRINT 'Table policies does not exist, create it...'
  83. SET ANSI_NULLS ON
  84. SET QUOTED_IDENTIFIER ON
  85. SET ANSI_PADDING ON
  86. CREATE TABLE [dbo].[policies](
  87. queue VARCHAR(256) COLLATE Latin1_General_100_BIN2 NOT NULL,
  88. policyType VARCHAR(256) NOT NULL,
  89. params VARBINARY(6000) NOT NULL,
  90. CONSTRAINT [pk_queue] PRIMARY KEY
  91. (
  92. [queue]
  93. )
  94. )
  95. SET ANSI_PADDING OFF
  96. PRINT 'Table policies created.'
  97. END
  98. ELSE
  99. PRINT 'Table policies exists, no operation required...'
  100. GO
  101. GO