daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Jan 14th, 2018 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  IF NOT EXISTS(SELECT * FROM sys.schemas WHERE [name] = N'dbo')      
  2.      EXEC (N'CREATE SCHEMA dbo')                                  
  3.  GO                                                              
  4. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'activity_data'  AND sc.name=N'dbo'  AND type in (N'U'))
  5. BEGIN
  6.  
  7.   DECLARE @drop_statement nvarchar(500)
  8.  
  9.   DECLARE drop_cursor CURSOR FOR
  10.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  11.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  12.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  13.       WHERE fk.referenced_object_id =
  14.           (
  15.              SELECT so.object_id
  16.              FROM sys.objects so JOIN sys.schemas sc
  17.              ON so.schema_id = sc.schema_id
  18.              WHERE so.name = N'activity_data'  AND sc.name=N'dbo'  AND type in (N'U')
  19.            )
  20.  
  21.   OPEN drop_cursor
  22.  
  23.   FETCH NEXT FROM drop_cursor
  24.   INTO @drop_statement
  25.  
  26.   WHILE @@FETCH_STATUS = 0
  27.   BEGIN
  28.      EXEC (@drop_statement)
  29.  
  30.      FETCH NEXT FROM drop_cursor
  31.      INTO @drop_statement
  32.   END
  33.  
  34.   CLOSE drop_cursor
  35.   DEALLOCATE drop_cursor
  36.  
  37.   DROP TABLE [dbo].[activity_data]
  38. END
  39. GO
  40.  
  41. SET ANSI_NULLS ON
  42. GO
  43. SET QUOTED_IDENTIFIER ON
  44. GO
  45. CREATE TABLE
  46. [dbo].[activity_data]
  47. (
  48.  
  49.    /*
  50.    *   SSMA informational messages:
  51.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  52.    */
  53.  
  54.    [id] int IDENTITY(1, 1)  NOT NULL,
  55.  
  56.    /*
  57.    *   SSMA informational messages:
  58.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  59.    */
  60.  
  61.    [member_id] int  NOT NULL,
  62.  
  63.    /*
  64.    *   SSMA informational messages:
  65.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Activity data id is in reply to'.
  66.    */
  67.  
  68.    [in_reply_to_activity_id] int DEFAULT NULL  NULL,
  69.  
  70.    /*
  71.    *   SSMA warning messages:
  72.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  73.  
  74.    *   SSMA informational messages:
  75.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Activity body'.
  76.    */
  77.  
  78.    [body] nvarchar(140)  NOT NULL,
  79.  
  80.    /*
  81.    *   SSMA warning messages:
  82.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  83.  
  84.    *   SSMA informational messages:
  85.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Activity URI'.
  86.    */
  87.  
  88.    [uri] nvarchar(max)  NULL,
  89.  
  90.    /*
  91.    *   SSMA informational messages:
  92.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Public flag of activity'.
  93.    *   M2SS0052: string literal was converted to NUMERIC literal
  94.    */
  95.  
  96.    [public_flag] smallint DEFAULT 1  NOT NULL,
  97.  
  98.    /*
  99.    *   SSMA informational messages:
  100.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Display this in PC?'.
  101.    *   M2SS0052: string literal was converted to NUMERIC literal
  102.    */
  103.  
  104.    [is_pc] smallint DEFAULT 1  NOT NULL,
  105.  
  106.    /*
  107.    *   SSMA informational messages:
  108.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Display this in Mobile?'.
  109.    *   M2SS0052: string literal was converted to NUMERIC literal
  110.    */
  111.  
  112.    [is_mobile] smallint DEFAULT 1  NOT NULL,
  113.  
  114.    /*
  115.    *   SSMA warning messages:
  116.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  117.  
  118.    *   SSMA informational messages:
  119.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'The source caption'.
  120.    */
  121.  
  122.    [source] nvarchar(64) DEFAULT NULL  NULL,
  123.  
  124.    /*
  125.    *   SSMA warning messages:
  126.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  127.  
  128.    *   SSMA informational messages:
  129.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'The source URI'.
  130.    */
  131.  
  132.    [source_uri] nvarchar(max)  NULL,
  133.  
  134.    /*
  135.    *   SSMA warning messages:
  136.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  137.  
  138.    *   SSMA informational messages:
  139.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Reference table name'.
  140.    */
  141.  
  142.    [foreign_table] nvarchar(max)  NULL,
  143.  
  144.    /*
  145.    *   SSMA informational messages:
  146.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'The id of reference table'.
  147.    */
  148.  
  149.    [foreign_id] bigint DEFAULT NULL  NULL,
  150.  
  151.    /*
  152.    *   SSMA warning messages:
  153.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  154.  
  155.    *   SSMA informational messages:
  156.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Template name'.
  157.    */
  158.  
  159.    [template] nvarchar(64) DEFAULT NULL  NULL,
  160.  
  161.    /*
  162.    *   SSMA warning messages:
  163.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  164.  
  165.    *   SSMA informational messages:
  166.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Params for template'.
  167.    */
  168.  
  169.    [template_param] nvarchar(max)  NULL,
  170.    [created_at] datetime2(0)  NOT NULL,
  171.    [updated_at] datetime2(0)  NOT NULL
  172. )
  173. GO
  174. BEGIN TRY
  175.     EXEC sp_addextendedproperty
  176.         N'MS_SSMA_SOURCE', N'dbo.activity_data',
  177.         N'SCHEMA', N'dbo',
  178.         N'TABLE', N'activity_data'
  179. END TRY
  180. BEGIN CATCH
  181.     IF (@@TRANCOUNT > 0) ROLLBACK
  182.     PRINT ERROR_MESSAGE()
  183. END CATCH
  184. GO
  185. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'activity_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  186. BEGIN
  187.  
  188.   DECLARE @drop_statement nvarchar(500)
  189.  
  190.   DECLARE drop_cursor CURSOR FOR
  191.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  192.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  193.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  194.       WHERE fk.referenced_object_id =
  195.           (
  196.              SELECT so.object_id
  197.              FROM sys.objects so JOIN sys.schemas sc
  198.              ON so.schema_id = sc.schema_id
  199.              WHERE so.name = N'activity_image'  AND sc.name=N'dbo'  AND type in (N'U')
  200.            )
  201.  
  202.   OPEN drop_cursor
  203.  
  204.   FETCH NEXT FROM drop_cursor
  205.   INTO @drop_statement
  206.  
  207.   WHILE @@FETCH_STATUS = 0
  208.   BEGIN
  209.      EXEC (@drop_statement)
  210.  
  211.      FETCH NEXT FROM drop_cursor
  212.      INTO @drop_statement
  213.   END
  214.  
  215.   CLOSE drop_cursor
  216.   DEALLOCATE drop_cursor
  217.  
  218.   DROP TABLE [dbo].[activity_image]
  219. END
  220. GO
  221.  
  222. SET ANSI_NULLS ON
  223. GO
  224. SET QUOTED_IDENTIFIER ON
  225. GO
  226. CREATE TABLE
  227. [dbo].[activity_image]
  228. (
  229.  
  230.    /*
  231.    *   SSMA informational messages:
  232.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  233.    */
  234.  
  235.    [id] int IDENTITY(1, 1)  NOT NULL,
  236.  
  237.    /*
  238.    *   SSMA informational messages:
  239.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Activity data id'.
  240.    */
  241.  
  242.    [activity_data_id] int  NOT NULL,
  243.  
  244.    /*
  245.    *   SSMA warning messages:
  246.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  247.  
  248.    *   SSMA informational messages:
  249.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'MIME type'.
  250.    */
  251.  
  252.    [mime_type] nvarchar(64)  NOT NULL,
  253.  
  254.    /*
  255.    *   SSMA warning messages:
  256.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  257.  
  258.    *   SSMA informational messages:
  259.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Image URI'.
  260.    */
  261.  
  262.    [uri] nvarchar(max)  NULL,
  263.  
  264.    /*
  265.    *   SSMA informational messages:
  266.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'File id'.
  267.    */
  268.  
  269.    [file_id] int DEFAULT NULL  NULL,
  270.    [created_at] datetime2(0)  NOT NULL,
  271.    [updated_at] datetime2(0)  NOT NULL
  272. )
  273. GO
  274. BEGIN TRY
  275.     EXEC sp_addextendedproperty
  276.         N'MS_SSMA_SOURCE', N'dbo.activity_image',
  277.         N'SCHEMA', N'dbo',
  278.         N'TABLE', N'activity_image'
  279. END TRY
  280. BEGIN CATCH
  281.     IF (@@TRANCOUNT > 0) ROLLBACK
  282.     PRINT ERROR_MESSAGE()
  283. END CATCH
  284. GO
  285. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'admin_user'  AND sc.name=N'dbo'  AND type in (N'U'))
  286. BEGIN
  287.  
  288.   DECLARE @drop_statement nvarchar(500)
  289.  
  290.   DECLARE drop_cursor CURSOR FOR
  291.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  292.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  293.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  294.       WHERE fk.referenced_object_id =
  295.           (
  296.              SELECT so.object_id
  297.              FROM sys.objects so JOIN sys.schemas sc
  298.              ON so.schema_id = sc.schema_id
  299.              WHERE so.name = N'admin_user'  AND sc.name=N'dbo'  AND type in (N'U')
  300.            )
  301.  
  302.   OPEN drop_cursor
  303.  
  304.   FETCH NEXT FROM drop_cursor
  305.   INTO @drop_statement
  306.  
  307.   WHILE @@FETCH_STATUS = 0
  308.   BEGIN
  309.      EXEC (@drop_statement)
  310.  
  311.      FETCH NEXT FROM drop_cursor
  312.      INTO @drop_statement
  313.   END
  314.  
  315.   CLOSE drop_cursor
  316.   DEALLOCATE drop_cursor
  317.  
  318.   DROP TABLE [dbo].[admin_user]
  319. END
  320. GO
  321.  
  322. SET ANSI_NULLS ON
  323. GO
  324. SET QUOTED_IDENTIFIER ON
  325. GO
  326. CREATE TABLE
  327. [dbo].[admin_user]
  328. (
  329.  
  330.    /*
  331.    *   SSMA informational messages:
  332.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  333.    */
  334.  
  335.    [id] int IDENTITY(2, 1)  NOT NULL,
  336.  
  337.    /*
  338.    *   SSMA warning messages:
  339.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  340.  
  341.    *   SSMA informational messages:
  342.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Administrator''s username'.
  343.    */
  344.  
  345.    [username] nvarchar(64) DEFAULT N''  NOT NULL,
  346.  
  347.    /*
  348.    *   SSMA warning messages:
  349.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  350.  
  351.    *   SSMA informational messages:
  352.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Administrator''s password'.
  353.    */
  354.  
  355.    [password] nvarchar(40) DEFAULT N''  NOT NULL,
  356.    [created_at] datetime2(0)  NOT NULL,
  357.    [updated_at] datetime2(0)  NOT NULL
  358. )
  359. GO
  360. BEGIN TRY
  361.     EXEC sp_addextendedproperty
  362.         N'MS_SSMA_SOURCE', N'dbo.admin_user',
  363.         N'SCHEMA', N'dbo',
  364.         N'TABLE', N'admin_user'
  365. END TRY
  366. BEGIN CATCH
  367.     IF (@@TRANCOUNT > 0) ROLLBACK
  368.     PRINT ERROR_MESSAGE()
  369. END CATCH
  370. GO
  371. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'album'  AND sc.name=N'dbo'  AND type in (N'U'))
  372. BEGIN
  373.  
  374.   DECLARE @drop_statement nvarchar(500)
  375.  
  376.   DECLARE drop_cursor CURSOR FOR
  377.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  378.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  379.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  380.       WHERE fk.referenced_object_id =
  381.           (
  382.              SELECT so.object_id
  383.              FROM sys.objects so JOIN sys.schemas sc
  384.              ON so.schema_id = sc.schema_id
  385.              WHERE so.name = N'album'  AND sc.name=N'dbo'  AND type in (N'U')
  386.            )
  387.  
  388.   OPEN drop_cursor
  389.  
  390.   FETCH NEXT FROM drop_cursor
  391.   INTO @drop_statement
  392.  
  393.   WHILE @@FETCH_STATUS = 0
  394.   BEGIN
  395.      EXEC (@drop_statement)
  396.  
  397.      FETCH NEXT FROM drop_cursor
  398.      INTO @drop_statement
  399.   END
  400.  
  401.   CLOSE drop_cursor
  402.   DEALLOCATE drop_cursor
  403.  
  404.   DROP TABLE [dbo].[album]
  405. END
  406. GO
  407.  
  408. SET ANSI_NULLS ON
  409. GO
  410. SET QUOTED_IDENTIFIER ON
  411. GO
  412. CREATE TABLE
  413. [dbo].[album]
  414. (
  415.    [id] int IDENTITY(1, 1)  NOT NULL,
  416.    [member_id] int DEFAULT NULL  NULL,
  417.    [title] nvarchar(max)  NOT NULL,
  418.    [body] nvarchar(max)  NOT NULL,
  419.  
  420.    /*
  421.    *   SSMA informational messages:
  422.    *   M2SS0052: string literal was converted to NUMERIC literal
  423.    */
  424.  
  425.    [public_flag] smallint DEFAULT 1  NOT NULL,
  426.    [file_id] int DEFAULT NULL  NULL,
  427.    [created_at] datetime2(0)  NOT NULL,
  428.    [updated_at] datetime2(0)  NOT NULL
  429. )
  430. GO
  431. BEGIN TRY
  432.     EXEC sp_addextendedproperty
  433.         N'MS_SSMA_SOURCE', N'dbo.album',
  434.         N'SCHEMA', N'dbo',
  435.         N'TABLE', N'album'
  436. END TRY
  437. BEGIN CATCH
  438.     IF (@@TRANCOUNT > 0) ROLLBACK
  439.     PRINT ERROR_MESSAGE()
  440. END CATCH
  441. GO
  442. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'album_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  443. BEGIN
  444.  
  445.   DECLARE @drop_statement nvarchar(500)
  446.  
  447.   DECLARE drop_cursor CURSOR FOR
  448.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  449.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  450.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  451.       WHERE fk.referenced_object_id =
  452.           (
  453.              SELECT so.object_id
  454.              FROM sys.objects so JOIN sys.schemas sc
  455.              ON so.schema_id = sc.schema_id
  456.              WHERE so.name = N'album_image'  AND sc.name=N'dbo'  AND type in (N'U')
  457.            )
  458.  
  459.   OPEN drop_cursor
  460.  
  461.   FETCH NEXT FROM drop_cursor
  462.   INTO @drop_statement
  463.  
  464.   WHILE @@FETCH_STATUS = 0
  465.   BEGIN
  466.      EXEC (@drop_statement)
  467.  
  468.      FETCH NEXT FROM drop_cursor
  469.      INTO @drop_statement
  470.   END
  471.  
  472.   CLOSE drop_cursor
  473.   DEALLOCATE drop_cursor
  474.  
  475.   DROP TABLE [dbo].[album_image]
  476. END
  477. GO
  478.  
  479. SET ANSI_NULLS ON
  480. GO
  481. SET QUOTED_IDENTIFIER ON
  482. GO
  483. CREATE TABLE
  484. [dbo].[album_image]
  485. (
  486.    [id] int IDENTITY(1, 1)  NOT NULL,
  487.    [album_id] int  NOT NULL,
  488.    [member_id] int  NOT NULL,
  489.    [file_id] int DEFAULT NULL  NULL,
  490.    [description] nvarchar(max)  NULL,
  491.    [filesize] bigint  NOT NULL,
  492.    [created_at] datetime2(0)  NOT NULL,
  493.    [updated_at] datetime2(0)  NOT NULL
  494. )
  495. GO
  496. BEGIN TRY
  497.     EXEC sp_addextendedproperty
  498.         N'MS_SSMA_SOURCE', N'dbo.album_image',
  499.         N'SCHEMA', N'dbo',
  500.         N'TABLE', N'album_image'
  501. END TRY
  502. BEGIN CATCH
  503.     IF (@@TRANCOUNT > 0) ROLLBACK
  504.     PRINT ERROR_MESSAGE()
  505. END CATCH
  506. GO
  507. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application'  AND sc.name=N'dbo'  AND type in (N'U'))
  508. BEGIN
  509.  
  510.   DECLARE @drop_statement nvarchar(500)
  511.  
  512.   DECLARE drop_cursor CURSOR FOR
  513.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  514.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  515.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  516.       WHERE fk.referenced_object_id =
  517.           (
  518.              SELECT so.object_id
  519.              FROM sys.objects so JOIN sys.schemas sc
  520.              ON so.schema_id = sc.schema_id
  521.              WHERE so.name = N'application'  AND sc.name=N'dbo'  AND type in (N'U')
  522.            )
  523.  
  524.   OPEN drop_cursor
  525.  
  526.   FETCH NEXT FROM drop_cursor
  527.   INTO @drop_statement
  528.  
  529.   WHILE @@FETCH_STATUS = 0
  530.   BEGIN
  531.      EXEC (@drop_statement)
  532.  
  533.      FETCH NEXT FROM drop_cursor
  534.      INTO @drop_statement
  535.   END
  536.  
  537.   CLOSE drop_cursor
  538.   DEALLOCATE drop_cursor
  539.  
  540.   DROP TABLE [dbo].[application]
  541. END
  542. GO
  543.  
  544. SET ANSI_NULLS ON
  545. GO
  546. SET QUOTED_IDENTIFIER ON
  547. GO
  548. CREATE TABLE
  549. [dbo].[application]
  550. (
  551.    [id] bigint IDENTITY(2, 1)  NOT NULL,
  552.    [member_id] int DEFAULT NULL  NULL,
  553.    [url] nvarchar(128)  NOT NULL,
  554.    [height] bigint DEFAULT NULL  NULL,
  555.  
  556.    /*
  557.    *   SSMA informational messages:
  558.    *   M2SS0052: string literal was converted to NUMERIC literal
  559.    */
  560.  
  561.    [scrolling] smallint DEFAULT 0  NOT NULL,
  562.  
  563.    /*
  564.    *   SSMA informational messages:
  565.    *   M2SS0052: string literal was converted to NUMERIC literal
  566.    */
  567.  
  568.    [singleton] smallint DEFAULT 1  NOT NULL,
  569.  
  570.    /*
  571.    *   SSMA informational messages:
  572.    *   M2SS0052: string literal was converted to NUMERIC literal
  573.    */
  574.  
  575.    [is_active] smallint DEFAULT 1  NOT NULL,
  576.  
  577.    /*
  578.    *   SSMA informational messages:
  579.    *   M2SS0052: string literal was converted to NUMERIC literal
  580.    */
  581.  
  582.    [is_pc] smallint DEFAULT 1  NOT NULL,
  583.  
  584.    /*
  585.    *   SSMA informational messages:
  586.    *   M2SS0052: string literal was converted to NUMERIC literal
  587.    */
  588.  
  589.    [is_mobile] smallint DEFAULT 0  NOT NULL,
  590.    [links] nvarchar(max)  NULL,
  591.    [consumer_key] nvarchar(16) DEFAULT N''  NOT NULL,
  592.    [consumer_secret] nvarchar(32) DEFAULT N''  NOT NULL
  593. )
  594. GO
  595. BEGIN TRY
  596.     EXEC sp_addextendedproperty
  597.         N'MS_SSMA_SOURCE', N'dbo.application',
  598.         N'SCHEMA', N'dbo',
  599.         N'TABLE', N'application'
  600. END TRY
  601. BEGIN CATCH
  602.     IF (@@TRANCOUNT > 0) ROLLBACK
  603.     PRINT ERROR_MESSAGE()
  604. END CATCH
  605. GO
  606. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_invite'  AND sc.name=N'dbo'  AND type in (N'U'))
  607. BEGIN
  608.  
  609.   DECLARE @drop_statement nvarchar(500)
  610.  
  611.   DECLARE drop_cursor CURSOR FOR
  612.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  613.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  614.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  615.       WHERE fk.referenced_object_id =
  616.           (
  617.              SELECT so.object_id
  618.              FROM sys.objects so JOIN sys.schemas sc
  619.              ON so.schema_id = sc.schema_id
  620.              WHERE so.name = N'application_invite'  AND sc.name=N'dbo'  AND type in (N'U')
  621.            )
  622.  
  623.   OPEN drop_cursor
  624.  
  625.   FETCH NEXT FROM drop_cursor
  626.   INTO @drop_statement
  627.  
  628.   WHILE @@FETCH_STATUS = 0
  629.   BEGIN
  630.      EXEC (@drop_statement)
  631.  
  632.      FETCH NEXT FROM drop_cursor
  633.      INTO @drop_statement
  634.   END
  635.  
  636.   CLOSE drop_cursor
  637.   DEALLOCATE drop_cursor
  638.  
  639.   DROP TABLE [dbo].[application_invite]
  640. END
  641. GO
  642.  
  643. SET ANSI_NULLS ON
  644. GO
  645. SET QUOTED_IDENTIFIER ON
  646. GO
  647. CREATE TABLE
  648. [dbo].[application_invite]
  649. (
  650.    [id] bigint IDENTITY(1, 1)  NOT NULL,
  651.    [application_id] bigint  NOT NULL,
  652.    [to_member_id] int  NOT NULL,
  653.    [from_member_id] int  NOT NULL,
  654.    [created_at] datetime2(0)  NOT NULL,
  655.    [updated_at] datetime2(0)  NOT NULL
  656. )
  657. GO
  658. BEGIN TRY
  659.     EXEC sp_addextendedproperty
  660.         N'MS_SSMA_SOURCE', N'dbo.application_invite',
  661.         N'SCHEMA', N'dbo',
  662.         N'TABLE', N'application_invite'
  663. END TRY
  664. BEGIN CATCH
  665.     IF (@@TRANCOUNT > 0) ROLLBACK
  666.     PRINT ERROR_MESSAGE()
  667. END CATCH
  668. GO
  669. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_lifecycle_event_queue'  AND sc.name=N'dbo'  AND type in (N'U'))
  670. BEGIN
  671.  
  672.   DECLARE @drop_statement nvarchar(500)
  673.  
  674.   DECLARE drop_cursor CURSOR FOR
  675.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  676.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  677.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  678.       WHERE fk.referenced_object_id =
  679.           (
  680.              SELECT so.object_id
  681.              FROM sys.objects so JOIN sys.schemas sc
  682.              ON so.schema_id = sc.schema_id
  683.              WHERE so.name = N'application_lifecycle_event_queue'  AND sc.name=N'dbo'  AND type in (N'U')
  684.            )
  685.  
  686.   OPEN drop_cursor
  687.  
  688.   FETCH NEXT FROM drop_cursor
  689.   INTO @drop_statement
  690.  
  691.   WHILE @@FETCH_STATUS = 0
  692.   BEGIN
  693.      EXEC (@drop_statement)
  694.  
  695.      FETCH NEXT FROM drop_cursor
  696.      INTO @drop_statement
  697.   END
  698.  
  699.   CLOSE drop_cursor
  700.   DEALLOCATE drop_cursor
  701.  
  702.   DROP TABLE [dbo].[application_lifecycle_event_queue]
  703. END
  704. GO
  705.  
  706. SET ANSI_NULLS ON
  707. GO
  708. SET QUOTED_IDENTIFIER ON
  709. GO
  710. CREATE TABLE
  711. [dbo].[application_lifecycle_event_queue]
  712. (
  713.    [id] bigint IDENTITY(1, 1)  NOT NULL,
  714.    [application_id] bigint  NOT NULL,
  715.    [member_id] int DEFAULT NULL  NULL,
  716.    [name] nvarchar(128)  NOT NULL,
  717.    [params] nvarchar(max)  NULL,
  718.    [created_at] datetime2(0)  NOT NULL,
  719.    [updated_at] datetime2(0)  NOT NULL
  720. )
  721. GO
  722. BEGIN TRY
  723.     EXEC sp_addextendedproperty
  724.         N'MS_SSMA_SOURCE', N'dbo.application_lifecycle_event_queue',
  725.         N'SCHEMA', N'dbo',
  726.         N'TABLE', N'application_lifecycle_event_queue'
  727. END TRY
  728. BEGIN CATCH
  729.     IF (@@TRANCOUNT > 0) ROLLBACK
  730.     PRINT ERROR_MESSAGE()
  731. END CATCH
  732. GO
  733. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_persistent_data'  AND sc.name=N'dbo'  AND type in (N'U'))
  734. BEGIN
  735.  
  736.   DECLARE @drop_statement nvarchar(500)
  737.  
  738.   DECLARE drop_cursor CURSOR FOR
  739.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  740.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  741.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  742.       WHERE fk.referenced_object_id =
  743.           (
  744.              SELECT so.object_id
  745.              FROM sys.objects so JOIN sys.schemas sc
  746.              ON so.schema_id = sc.schema_id
  747.              WHERE so.name = N'application_persistent_data'  AND sc.name=N'dbo'  AND type in (N'U')
  748.            )
  749.  
  750.   OPEN drop_cursor
  751.  
  752.   FETCH NEXT FROM drop_cursor
  753.   INTO @drop_statement
  754.  
  755.   WHILE @@FETCH_STATUS = 0
  756.   BEGIN
  757.      EXEC (@drop_statement)
  758.  
  759.      FETCH NEXT FROM drop_cursor
  760.      INTO @drop_statement
  761.   END
  762.  
  763.   CLOSE drop_cursor
  764.   DEALLOCATE drop_cursor
  765.  
  766.   DROP TABLE [dbo].[application_persistent_data]
  767. END
  768. GO
  769.  
  770. SET ANSI_NULLS ON
  771. GO
  772. SET QUOTED_IDENTIFIER ON
  773. GO
  774. CREATE TABLE
  775. [dbo].[application_persistent_data]
  776. (
  777.    [id] bigint IDENTITY(1, 1)  NOT NULL,
  778.    [application_id] bigint  NOT NULL,
  779.    [member_id] int  NOT NULL,
  780.    [name] nvarchar(128)  NOT NULL,
  781.    [value] nvarchar(max)  NULL
  782. )
  783. GO
  784. BEGIN TRY
  785.     EXEC sp_addextendedproperty
  786.         N'MS_SSMA_SOURCE', N'dbo.application_persistent_data',
  787.         N'SCHEMA', N'dbo',
  788.         N'TABLE', N'application_persistent_data'
  789. END TRY
  790. BEGIN CATCH
  791.     IF (@@TRANCOUNT > 0) ROLLBACK
  792.     PRINT ERROR_MESSAGE()
  793. END CATCH
  794. GO
  795. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_translation'  AND sc.name=N'dbo'  AND type in (N'U'))
  796. BEGIN
  797.  
  798.   DECLARE @drop_statement nvarchar(500)
  799.  
  800.   DECLARE drop_cursor CURSOR FOR
  801.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  802.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  803.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  804.       WHERE fk.referenced_object_id =
  805.           (
  806.              SELECT so.object_id
  807.              FROM sys.objects so JOIN sys.schemas sc
  808.              ON so.schema_id = sc.schema_id
  809.              WHERE so.name = N'application_translation'  AND sc.name=N'dbo'  AND type in (N'U')
  810.            )
  811.  
  812.   OPEN drop_cursor
  813.  
  814.   FETCH NEXT FROM drop_cursor
  815.   INTO @drop_statement
  816.  
  817.   WHILE @@FETCH_STATUS = 0
  818.   BEGIN
  819.      EXEC (@drop_statement)
  820.  
  821.      FETCH NEXT FROM drop_cursor
  822.      INTO @drop_statement
  823.   END
  824.  
  825.   CLOSE drop_cursor
  826.   DEALLOCATE drop_cursor
  827.  
  828.   DROP TABLE [dbo].[application_translation]
  829. END
  830. GO
  831.  
  832. SET ANSI_NULLS ON
  833. GO
  834. SET QUOTED_IDENTIFIER ON
  835. GO
  836. CREATE TABLE
  837. [dbo].[application_translation]
  838. (
  839.  
  840.    /*
  841.    *   SSMA informational messages:
  842.    *   M2SS0052: string literal was converted to NUMERIC literal
  843.    */
  844.  
  845.    [id] bigint DEFAULT 0  NOT NULL,
  846.    [title] nvarchar(128) DEFAULT NULL  NULL,
  847.    [title_url] nvarchar(128) DEFAULT NULL  NULL,
  848.    [description] nvarchar(max)  NULL,
  849.    [directory_title] nvarchar(128) DEFAULT NULL  NULL,
  850.    [screenshot] nvarchar(128) DEFAULT NULL  NULL,
  851.    [thumbnail] nvarchar(128) DEFAULT NULL  NULL,
  852.    [author] nvarchar(128) DEFAULT NULL  NULL,
  853.    [author_aboutme] nvarchar(max)  NULL,
  854.    [author_affiliation] nvarchar(128) DEFAULT NULL  NULL,
  855.    [author_email] nvarchar(128) DEFAULT NULL  NULL,
  856.    [author_photo] nvarchar(128) DEFAULT NULL  NULL,
  857.    [author_link] nvarchar(128) DEFAULT NULL  NULL,
  858.    [author_quote] nvarchar(max)  NULL,
  859.    [settings] nvarchar(max)  NULL,
  860.    [views] nvarchar(max)  NULL,
  861.    [lang] nchar(5) DEFAULT N''  NOT NULL,
  862.    [created_at] datetime2(0)  NOT NULL,
  863.    [updated_at] datetime2(0)  NOT NULL
  864. )
  865. GO
  866. BEGIN TRY
  867.     EXEC sp_addextendedproperty
  868.         N'MS_SSMA_SOURCE', N'dbo.application_translation',
  869.         N'SCHEMA', N'dbo',
  870.         N'TABLE', N'application_translation'
  871. END TRY
  872. BEGIN CATCH
  873.     IF (@@TRANCOUNT > 0) ROLLBACK
  874.     PRINT ERROR_MESSAGE()
  875. END CATCH
  876. GO
  877. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'ashiato'  AND sc.name=N'dbo'  AND type in (N'U'))
  878. BEGIN
  879.  
  880.   DECLARE @drop_statement nvarchar(500)
  881.  
  882.   DECLARE drop_cursor CURSOR FOR
  883.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  884.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  885.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  886.       WHERE fk.referenced_object_id =
  887.           (
  888.              SELECT so.object_id
  889.              FROM sys.objects so JOIN sys.schemas sc
  890.              ON so.schema_id = sc.schema_id
  891.              WHERE so.name = N'ashiato'  AND sc.name=N'dbo'  AND type in (N'U')
  892.            )
  893.  
  894.   OPEN drop_cursor
  895.  
  896.   FETCH NEXT FROM drop_cursor
  897.   INTO @drop_statement
  898.  
  899.   WHILE @@FETCH_STATUS = 0
  900.   BEGIN
  901.      EXEC (@drop_statement)
  902.  
  903.      FETCH NEXT FROM drop_cursor
  904.      INTO @drop_statement
  905.   END
  906.  
  907.   CLOSE drop_cursor
  908.   DEALLOCATE drop_cursor
  909.  
  910.   DROP TABLE [dbo].[ashiato]
  911. END
  912. GO
  913.  
  914. SET ANSI_NULLS ON
  915. GO
  916. SET QUOTED_IDENTIFIER ON
  917. GO
  918. CREATE TABLE
  919. [dbo].[ashiato]
  920. (
  921.    [id] int IDENTITY(1, 1)  NOT NULL,
  922.    [member_id_from] int DEFAULT NULL  NULL,
  923.    [member_id_to] int DEFAULT NULL  NULL,
  924.    [r_date] date DEFAULT NULL  NULL,
  925.    [created_at] datetime2(0)  NOT NULL,
  926.    [updated_at] datetime2(0)  NOT NULL
  927. )
  928. GO
  929. BEGIN TRY
  930.     EXEC sp_addextendedproperty
  931.         N'MS_SSMA_SOURCE', N'dbo.ashiato',
  932.         N'SCHEMA', N'dbo',
  933.         N'TABLE', N'ashiato'
  934. END TRY
  935. BEGIN CATCH
  936.     IF (@@TRANCOUNT > 0) ROLLBACK
  937.     PRINT ERROR_MESSAGE()
  938. END CATCH
  939. GO
  940. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner'  AND sc.name=N'dbo'  AND type in (N'U'))
  941. BEGIN
  942.  
  943.   DECLARE @drop_statement nvarchar(500)
  944.  
  945.   DECLARE drop_cursor CURSOR FOR
  946.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  947.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  948.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  949.       WHERE fk.referenced_object_id =
  950.           (
  951.              SELECT so.object_id
  952.              FROM sys.objects so JOIN sys.schemas sc
  953.              ON so.schema_id = sc.schema_id
  954.              WHERE so.name = N'banner'  AND sc.name=N'dbo'  AND type in (N'U')
  955.            )
  956.  
  957.   OPEN drop_cursor
  958.  
  959.   FETCH NEXT FROM drop_cursor
  960.   INTO @drop_statement
  961.  
  962.   WHILE @@FETCH_STATUS = 0
  963.   BEGIN
  964.      EXEC (@drop_statement)
  965.  
  966.      FETCH NEXT FROM drop_cursor
  967.      INTO @drop_statement
  968.   END
  969.  
  970.   CLOSE drop_cursor
  971.   DEALLOCATE drop_cursor
  972.  
  973.   DROP TABLE [dbo].[banner]
  974. END
  975. GO
  976.  
  977. SET ANSI_NULLS ON
  978. GO
  979. SET QUOTED_IDENTIFIER ON
  980. GO
  981. CREATE TABLE
  982. [dbo].[banner]
  983. (
  984.  
  985.    /*
  986.    *   SSMA informational messages:
  987.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  988.    */
  989.  
  990.    [id] int IDENTITY(5, 1)  NOT NULL,
  991.  
  992.    /*
  993.    *   SSMA warning messages:
  994.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  995.  
  996.    *   SSMA informational messages:
  997.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Banner name'.
  998.    */
  999.  
  1000.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  1001.  
  1002.    /*
  1003.    *   SSMA warning messages:
  1004.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1005.  
  1006.    *   SSMA informational messages:
  1007.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'HTML of free input banner'.
  1008.    */
  1009.  
  1010.    [html] nvarchar(max)  NULL,
  1011.  
  1012.    /*
  1013.    *   SSMA informational messages:
  1014.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'This is free HTML banner'.
  1015.    *   M2SS0052: string literal was converted to NUMERIC literal
  1016.    */
  1017.  
  1018.    [is_use_html] smallint DEFAULT 0  NOT NULL
  1019. )
  1020. GO
  1021. BEGIN TRY
  1022.     EXEC sp_addextendedproperty
  1023.         N'MS_SSMA_SOURCE', N'dbo.banner',
  1024.         N'SCHEMA', N'dbo',
  1025.         N'TABLE', N'banner'
  1026. END TRY
  1027. BEGIN CATCH
  1028.     IF (@@TRANCOUNT > 0) ROLLBACK
  1029.     PRINT ERROR_MESSAGE()
  1030. END CATCH
  1031. GO
  1032. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  1033. BEGIN
  1034.  
  1035.   DECLARE @drop_statement nvarchar(500)
  1036.  
  1037.   DECLARE drop_cursor CURSOR FOR
  1038.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1039.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1040.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1041.       WHERE fk.referenced_object_id =
  1042.           (
  1043.              SELECT so.object_id
  1044.              FROM sys.objects so JOIN sys.schemas sc
  1045.              ON so.schema_id = sc.schema_id
  1046.              WHERE so.name = N'banner_image'  AND sc.name=N'dbo'  AND type in (N'U')
  1047.            )
  1048.  
  1049.   OPEN drop_cursor
  1050.  
  1051.   FETCH NEXT FROM drop_cursor
  1052.   INTO @drop_statement
  1053.  
  1054.   WHILE @@FETCH_STATUS = 0
  1055.   BEGIN
  1056.      EXEC (@drop_statement)
  1057.  
  1058.      FETCH NEXT FROM drop_cursor
  1059.      INTO @drop_statement
  1060.   END
  1061.  
  1062.   CLOSE drop_cursor
  1063.   DEALLOCATE drop_cursor
  1064.  
  1065.   DROP TABLE [dbo].[banner_image]
  1066. END
  1067. GO
  1068.  
  1069. SET ANSI_NULLS ON
  1070. GO
  1071. SET QUOTED_IDENTIFIER ON
  1072. GO
  1073. CREATE TABLE
  1074. [dbo].[banner_image]
  1075. (
  1076.  
  1077.    /*
  1078.    *   SSMA informational messages:
  1079.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  1080.    */
  1081.  
  1082.    [id] int IDENTITY(1, 1)  NOT NULL,
  1083.  
  1084.    /*
  1085.    *   SSMA informational messages:
  1086.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'An image''s file id'.
  1087.    */
  1088.  
  1089.    [file_id] int  NOT NULL,
  1090.  
  1091.    /*
  1092.    *   SSMA warning messages:
  1093.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1094.  
  1095.    *   SSMA informational messages:
  1096.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'URL of linked Web page'.
  1097.    */
  1098.  
  1099.    [url] nvarchar(max)  NULL,
  1100.  
  1101.    /*
  1102.    *   SSMA warning messages:
  1103.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1104.  
  1105.    *   SSMA informational messages:
  1106.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Banner image name'.
  1107.    */
  1108.  
  1109.    [name] nvarchar(64) DEFAULT NULL  NULL,
  1110.    [created_at] datetime2(0)  NOT NULL,
  1111.    [updated_at] datetime2(0)  NOT NULL
  1112. )
  1113. GO
  1114. BEGIN TRY
  1115.     EXEC sp_addextendedproperty
  1116.         N'MS_SSMA_SOURCE', N'dbo.banner_image',
  1117.         N'SCHEMA', N'dbo',
  1118.         N'TABLE', N'banner_image'
  1119. END TRY
  1120. BEGIN CATCH
  1121.     IF (@@TRANCOUNT > 0) ROLLBACK
  1122.     PRINT ERROR_MESSAGE()
  1123. END CATCH
  1124. GO
  1125. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner_translation'  AND sc.name=N'dbo'  AND type in (N'U'))
  1126. BEGIN
  1127.  
  1128.   DECLARE @drop_statement nvarchar(500)
  1129.  
  1130.   DECLARE drop_cursor CURSOR FOR
  1131.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1132.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1133.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1134.       WHERE fk.referenced_object_id =
  1135.           (
  1136.              SELECT so.object_id
  1137.              FROM sys.objects so JOIN sys.schemas sc
  1138.              ON so.schema_id = sc.schema_id
  1139.              WHERE so.name = N'banner_translation'  AND sc.name=N'dbo'  AND type in (N'U')
  1140.            )
  1141.  
  1142.   OPEN drop_cursor
  1143.  
  1144.   FETCH NEXT FROM drop_cursor
  1145.   INTO @drop_statement
  1146.  
  1147.   WHILE @@FETCH_STATUS = 0
  1148.   BEGIN
  1149.      EXEC (@drop_statement)
  1150.  
  1151.      FETCH NEXT FROM drop_cursor
  1152.      INTO @drop_statement
  1153.   END
  1154.  
  1155.   CLOSE drop_cursor
  1156.   DEALLOCATE drop_cursor
  1157.  
  1158.   DROP TABLE [dbo].[banner_translation]
  1159. END
  1160. GO
  1161.  
  1162. SET ANSI_NULLS ON
  1163. GO
  1164. SET QUOTED_IDENTIFIER ON
  1165. GO
  1166. CREATE TABLE
  1167. [dbo].[banner_translation]
  1168. (
  1169.  
  1170.    /*
  1171.    *   SSMA informational messages:
  1172.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  1173.    *   M2SS0052: string literal was converted to NUMERIC literal
  1174.    */
  1175.  
  1176.    [id] int DEFAULT 0  NOT NULL,
  1177.  
  1178.    /*
  1179.    *   SSMA warning messages:
  1180.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1181.  
  1182.    *   SSMA informational messages:
  1183.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Description'.
  1184.    */
  1185.  
  1186.    [caption] nvarchar(max)  NOT NULL,
  1187.  
  1188.    /*
  1189.    *   SSMA warning messages:
  1190.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1191.    */
  1192.  
  1193.    [lang] nchar(5) DEFAULT N''  NOT NULL
  1194. )
  1195. GO
  1196. BEGIN TRY
  1197.     EXEC sp_addextendedproperty
  1198.         N'MS_SSMA_SOURCE', N'dbo.banner_translation',
  1199.         N'SCHEMA', N'dbo',
  1200.         N'TABLE', N'banner_translation'
  1201. END TRY
  1202. BEGIN CATCH
  1203.     IF (@@TRANCOUNT > 0) ROLLBACK
  1204.     PRINT ERROR_MESSAGE()
  1205. END CATCH
  1206. GO
  1207. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner_use_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  1208. BEGIN
  1209.  
  1210.   DECLARE @drop_statement nvarchar(500)
  1211.  
  1212.   DECLARE drop_cursor CURSOR FOR
  1213.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1214.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1215.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1216.       WHERE fk.referenced_object_id =
  1217.           (
  1218.              SELECT so.object_id
  1219.              FROM sys.objects so JOIN sys.schemas sc
  1220.              ON so.schema_id = sc.schema_id
  1221.              WHERE so.name = N'banner_use_image'  AND sc.name=N'dbo'  AND type in (N'U')
  1222.            )
  1223.  
  1224.   OPEN drop_cursor
  1225.  
  1226.   FETCH NEXT FROM drop_cursor
  1227.   INTO @drop_statement
  1228.  
  1229.   WHILE @@FETCH_STATUS = 0
  1230.   BEGIN
  1231.      EXEC (@drop_statement)
  1232.  
  1233.      FETCH NEXT FROM drop_cursor
  1234.      INTO @drop_statement
  1235.   END
  1236.  
  1237.   CLOSE drop_cursor
  1238.   DEALLOCATE drop_cursor
  1239.  
  1240.   DROP TABLE [dbo].[banner_use_image]
  1241. END
  1242. GO
  1243.  
  1244. SET ANSI_NULLS ON
  1245. GO
  1246. SET QUOTED_IDENTIFIER ON
  1247. GO
  1248. CREATE TABLE
  1249. [dbo].[banner_use_image]
  1250. (
  1251.  
  1252.    /*
  1253.    *   SSMA informational messages:
  1254.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  1255.    */
  1256.  
  1257.    [id] int IDENTITY(1, 1)  NOT NULL,
  1258.  
  1259.    /*
  1260.    *   SSMA informational messages:
  1261.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Banner id'.
  1262.    */
  1263.  
  1264.    [banner_id] int  NOT NULL,
  1265.  
  1266.    /*
  1267.    *   SSMA informational messages:
  1268.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'BannerImage id'.
  1269.    */
  1270.  
  1271.    [banner_image_id] int  NOT NULL,
  1272.    [created_at] datetime2(0)  NOT NULL,
  1273.    [updated_at] datetime2(0)  NOT NULL
  1274. )
  1275. GO
  1276. BEGIN TRY
  1277.     EXEC sp_addextendedproperty
  1278.         N'MS_SSMA_SOURCE', N'dbo.banner_use_image',
  1279.         N'SCHEMA', N'dbo',
  1280.         N'TABLE', N'banner_use_image'
  1281. END TRY
  1282. BEGIN CATCH
  1283.     IF (@@TRANCOUNT > 0) ROLLBACK
  1284.     PRINT ERROR_MESSAGE()
  1285. END CATCH
  1286. GO
  1287. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'blacklist'  AND sc.name=N'dbo'  AND type in (N'U'))
  1288. BEGIN
  1289.  
  1290.   DECLARE @drop_statement nvarchar(500)
  1291.  
  1292.   DECLARE drop_cursor CURSOR FOR
  1293.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1294.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1295.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1296.       WHERE fk.referenced_object_id =
  1297.           (
  1298.              SELECT so.object_id
  1299.              FROM sys.objects so JOIN sys.schemas sc
  1300.              ON so.schema_id = sc.schema_id
  1301.              WHERE so.name = N'blacklist'  AND sc.name=N'dbo'  AND type in (N'U')
  1302.            )
  1303.  
  1304.   OPEN drop_cursor
  1305.  
  1306.   FETCH NEXT FROM drop_cursor
  1307.   INTO @drop_statement
  1308.  
  1309.   WHILE @@FETCH_STATUS = 0
  1310.   BEGIN
  1311.      EXEC (@drop_statement)
  1312.  
  1313.      FETCH NEXT FROM drop_cursor
  1314.      INTO @drop_statement
  1315.   END
  1316.  
  1317.   CLOSE drop_cursor
  1318.   DEALLOCATE drop_cursor
  1319.  
  1320.   DROP TABLE [dbo].[blacklist]
  1321. END
  1322. GO
  1323.  
  1324. SET ANSI_NULLS ON
  1325. GO
  1326. SET QUOTED_IDENTIFIER ON
  1327. GO
  1328. CREATE TABLE
  1329. [dbo].[blacklist]
  1330. (
  1331.  
  1332.    /*
  1333.    *   SSMA informational messages:
  1334.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  1335.    */
  1336.  
  1337.    [id] int IDENTITY(1, 1)  NOT NULL,
  1338.  
  1339.    /*
  1340.    *   SSMA warning messages:
  1341.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1342.  
  1343.    *   SSMA informational messages:
  1344.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Mobile identified number'.
  1345.    */
  1346.  
  1347.    [uid] nvarchar(32) DEFAULT N''  NOT NULL,
  1348.  
  1349.    /*
  1350.    *   SSMA warning messages:
  1351.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1352.  
  1353.    *   SSMA informational messages:
  1354.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Free memo'.
  1355.    */
  1356.  
  1357.    [memo] nvarchar(max)  NULL,
  1358.    [created_at] datetime2(0)  NOT NULL,
  1359.    [updated_at] datetime2(0)  NOT NULL
  1360. )
  1361. GO
  1362. BEGIN TRY
  1363.     EXEC sp_addextendedproperty
  1364.         N'MS_SSMA_SOURCE', N'dbo.blacklist',
  1365.         N'SCHEMA', N'dbo',
  1366.         N'TABLE', N'blacklist'
  1367. END TRY
  1368. BEGIN CATCH
  1369.     IF (@@TRANCOUNT > 0) ROLLBACK
  1370.     PRINT ERROR_MESSAGE()
  1371. END CATCH
  1372. GO
  1373. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'blog_rss_cache'  AND sc.name=N'dbo'  AND type in (N'U'))
  1374. BEGIN
  1375.  
  1376.   DECLARE @drop_statement nvarchar(500)
  1377.  
  1378.   DECLARE drop_cursor CURSOR FOR
  1379.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1380.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1381.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1382.       WHERE fk.referenced_object_id =
  1383.           (
  1384.              SELECT so.object_id
  1385.              FROM sys.objects so JOIN sys.schemas sc
  1386.              ON so.schema_id = sc.schema_id
  1387.              WHERE so.name = N'blog_rss_cache'  AND sc.name=N'dbo'  AND type in (N'U')
  1388.            )
  1389.  
  1390.   OPEN drop_cursor
  1391.  
  1392.   FETCH NEXT FROM drop_cursor
  1393.   INTO @drop_statement
  1394.  
  1395.   WHILE @@FETCH_STATUS = 0
  1396.   BEGIN
  1397.      EXEC (@drop_statement)
  1398.  
  1399.      FETCH NEXT FROM drop_cursor
  1400.      INTO @drop_statement
  1401.   END
  1402.  
  1403.   CLOSE drop_cursor
  1404.   DEALLOCATE drop_cursor
  1405.  
  1406.   DROP TABLE [dbo].[blog_rss_cache]
  1407. END
  1408. GO
  1409.  
  1410. SET ANSI_NULLS ON
  1411. GO
  1412. SET QUOTED_IDENTIFIER ON
  1413. GO
  1414. CREATE TABLE
  1415. [dbo].[blog_rss_cache]
  1416. (
  1417.    [id] int IDENTITY(1, 1)  NOT NULL,
  1418.    [member_id] int DEFAULT NULL  NULL,
  1419.    [title] nvarchar(max)  NULL,
  1420.    [description] nvarchar(max)  NULL,
  1421.    [link] nvarchar(max)  NULL,
  1422.    [date] datetime2(0) DEFAULT NULL  NULL,
  1423.    [created_at] datetime2(0)  NOT NULL,
  1424.    [updated_at] datetime2(0)  NOT NULL
  1425. )
  1426. GO
  1427. BEGIN TRY
  1428.     EXEC sp_addextendedproperty
  1429.         N'MS_SSMA_SOURCE', N'dbo.blog_rss_cache',
  1430.         N'SCHEMA', N'dbo',
  1431.         N'TABLE', N'blog_rss_cache'
  1432. END TRY
  1433. BEGIN CATCH
  1434.     IF (@@TRANCOUNT > 0) ROLLBACK
  1435.     PRINT ERROR_MESSAGE()
  1436. END CATCH
  1437. GO
  1438. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community'  AND sc.name=N'dbo'  AND type in (N'U'))
  1439. BEGIN
  1440.  
  1441.   DECLARE @drop_statement nvarchar(500)
  1442.  
  1443.   DECLARE drop_cursor CURSOR FOR
  1444.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1445.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1446.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1447.       WHERE fk.referenced_object_id =
  1448.           (
  1449.              SELECT so.object_id
  1450.              FROM sys.objects so JOIN sys.schemas sc
  1451.              ON so.schema_id = sc.schema_id
  1452.              WHERE so.name = N'community'  AND sc.name=N'dbo'  AND type in (N'U')
  1453.            )
  1454.  
  1455.   OPEN drop_cursor
  1456.  
  1457.   FETCH NEXT FROM drop_cursor
  1458.   INTO @drop_statement
  1459.  
  1460.   WHILE @@FETCH_STATUS = 0
  1461.   BEGIN
  1462.      EXEC (@drop_statement)
  1463.  
  1464.      FETCH NEXT FROM drop_cursor
  1465.      INTO @drop_statement
  1466.   END
  1467.  
  1468.   CLOSE drop_cursor
  1469.   DEALLOCATE drop_cursor
  1470.  
  1471.   DROP TABLE [dbo].[community]
  1472. END
  1473. GO
  1474.  
  1475. SET ANSI_NULLS ON
  1476. GO
  1477. SET QUOTED_IDENTIFIER ON
  1478. GO
  1479. CREATE TABLE
  1480. [dbo].[community]
  1481. (
  1482.  
  1483.    /*
  1484.    *   SSMA informational messages:
  1485.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  1486.    */
  1487.  
  1488.    [id] int IDENTITY(1, 1)  NOT NULL,
  1489.  
  1490.    /*
  1491.    *   SSMA warning messages:
  1492.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1493.  
  1494.    *   SSMA informational messages:
  1495.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Community name'.
  1496.    */
  1497.  
  1498.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  1499.  
  1500.    /*
  1501.    *   SSMA informational messages:
  1502.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Top image file id'.
  1503.    */
  1504.  
  1505.    [file_id] int DEFAULT NULL  NULL,
  1506.  
  1507.    /*
  1508.    *   SSMA informational messages:
  1509.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Community category id'.
  1510.    */
  1511.  
  1512.    [community_category_id] int DEFAULT NULL  NULL,
  1513.    [created_at] datetime2(0)  NOT NULL,
  1514.    [updated_at] datetime2(0)  NOT NULL
  1515. )
  1516. GO
  1517. BEGIN TRY
  1518.     EXEC sp_addextendedproperty
  1519.         N'MS_SSMA_SOURCE', N'dbo.community',
  1520.         N'SCHEMA', N'dbo',
  1521.         N'TABLE', N'community'
  1522. END TRY
  1523. BEGIN CATCH
  1524.     IF (@@TRANCOUNT > 0) ROLLBACK
  1525.     PRINT ERROR_MESSAGE()
  1526. END CATCH
  1527. GO
  1528. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_category'  AND sc.name=N'dbo'  AND type in (N'U'))
  1529. BEGIN
  1530.  
  1531.   DECLARE @drop_statement nvarchar(500)
  1532.  
  1533.   DECLARE drop_cursor CURSOR FOR
  1534.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1535.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1536.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1537.       WHERE fk.referenced_object_id =
  1538.           (
  1539.              SELECT so.object_id
  1540.              FROM sys.objects so JOIN sys.schemas sc
  1541.              ON so.schema_id = sc.schema_id
  1542.              WHERE so.name = N'community_category'  AND sc.name=N'dbo'  AND type in (N'U')
  1543.            )
  1544.  
  1545.   OPEN drop_cursor
  1546.  
  1547.   FETCH NEXT FROM drop_cursor
  1548.   INTO @drop_statement
  1549.  
  1550.   WHILE @@FETCH_STATUS = 0
  1551.   BEGIN
  1552.      EXEC (@drop_statement)
  1553.  
  1554.      FETCH NEXT FROM drop_cursor
  1555.      INTO @drop_statement
  1556.   END
  1557.  
  1558.   CLOSE drop_cursor
  1559.   DEALLOCATE drop_cursor
  1560.  
  1561.   DROP TABLE [dbo].[community_category]
  1562. END
  1563. GO
  1564.  
  1565. SET ANSI_NULLS ON
  1566. GO
  1567. SET QUOTED_IDENTIFIER ON
  1568. GO
  1569. CREATE TABLE
  1570. [dbo].[community_category]
  1571. (
  1572.  
  1573.    /*
  1574.    *   SSMA informational messages:
  1575.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  1576.    */
  1577.  
  1578.    [id] int IDENTITY(5, 1)  NOT NULL,
  1579.  
  1580.    /*
  1581.    *   SSMA warning messages:
  1582.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1583.  
  1584.    *   SSMA informational messages:
  1585.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Category name'.
  1586.    */
  1587.  
  1588.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  1589.  
  1590.    /*
  1591.    *   SSMA informational messages:
  1592.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member can create this category community'.
  1593.    *   M2SS0052: string literal was converted to NUMERIC literal
  1594.    */
  1595.  
  1596.    [is_allow_member_community] smallint DEFAULT 1  NOT NULL,
  1597.  
  1598.    /*
  1599.    *   SSMA informational messages:
  1600.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Nested tree key'.
  1601.    */
  1602.  
  1603.    [tree_key] int DEFAULT NULL  NULL,
  1604.  
  1605.    /*
  1606.    *   SSMA informational messages:
  1607.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Order to sort'.
  1608.    */
  1609.  
  1610.    [sort_order] int DEFAULT NULL  NULL,
  1611.    [lft] int DEFAULT NULL  NULL,
  1612.    [rgt] int DEFAULT NULL  NULL,
  1613.    [level] smallint DEFAULT NULL  NULL,
  1614.    [created_at] datetime2(0)  NOT NULL,
  1615.    [updated_at] datetime2(0)  NOT NULL
  1616. )
  1617. GO
  1618. BEGIN TRY
  1619.     EXEC sp_addextendedproperty
  1620.         N'MS_SSMA_SOURCE', N'dbo.community_category',
  1621.         N'SCHEMA', N'dbo',
  1622.         N'TABLE', N'community_category'
  1623. END TRY
  1624. BEGIN CATCH
  1625.     IF (@@TRANCOUNT > 0) ROLLBACK
  1626.     PRINT ERROR_MESSAGE()
  1627. END CATCH
  1628. GO
  1629. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_config'  AND sc.name=N'dbo'  AND type in (N'U'))
  1630. BEGIN
  1631.  
  1632.   DECLARE @drop_statement nvarchar(500)
  1633.  
  1634.   DECLARE drop_cursor CURSOR FOR
  1635.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1636.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1637.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1638.       WHERE fk.referenced_object_id =
  1639.           (
  1640.              SELECT so.object_id
  1641.              FROM sys.objects so JOIN sys.schemas sc
  1642.              ON so.schema_id = sc.schema_id
  1643.              WHERE so.name = N'community_config'  AND sc.name=N'dbo'  AND type in (N'U')
  1644.            )
  1645.  
  1646.   OPEN drop_cursor
  1647.  
  1648.   FETCH NEXT FROM drop_cursor
  1649.   INTO @drop_statement
  1650.  
  1651.   WHILE @@FETCH_STATUS = 0
  1652.   BEGIN
  1653.      EXEC (@drop_statement)
  1654.  
  1655.      FETCH NEXT FROM drop_cursor
  1656.      INTO @drop_statement
  1657.   END
  1658.  
  1659.   CLOSE drop_cursor
  1660.   DEALLOCATE drop_cursor
  1661.  
  1662.   DROP TABLE [dbo].[community_config]
  1663. END
  1664. GO
  1665.  
  1666. SET ANSI_NULLS ON
  1667. GO
  1668. SET QUOTED_IDENTIFIER ON
  1669. GO
  1670. CREATE TABLE
  1671. [dbo].[community_config]
  1672. (
  1673.  
  1674.    /*
  1675.    *   SSMA informational messages:
  1676.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  1677.    */
  1678.  
  1679.    [id] int IDENTITY(1, 1)  NOT NULL,
  1680.  
  1681.    /*
  1682.    *   SSMA informational messages:
  1683.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Community id'.
  1684.    */
  1685.  
  1686.    [community_id] int  NOT NULL,
  1687.  
  1688.    /*
  1689.    *   SSMA warning messages:
  1690.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1691.  
  1692.    *   SSMA informational messages:
  1693.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration name'.
  1694.    */
  1695.  
  1696.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  1697.  
  1698.    /*
  1699.    *   SSMA warning messages:
  1700.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  1701.  
  1702.    *   SSMA informational messages:
  1703.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration value'.
  1704.    */
  1705.  
  1706.    [value] nvarchar(max)  NULL,
  1707.    [created_at] datetime2(0)  NOT NULL,
  1708.    [updated_at] datetime2(0)  NOT NULL
  1709. )
  1710. GO
  1711. BEGIN TRY
  1712.     EXEC sp_addextendedproperty
  1713.         N'MS_SSMA_SOURCE', N'dbo.community_config',
  1714.         N'SCHEMA', N'dbo',
  1715.         N'TABLE', N'community_config'
  1716. END TRY
  1717. BEGIN CATCH
  1718.     IF (@@TRANCOUNT > 0) ROLLBACK
  1719.     PRINT ERROR_MESSAGE()
  1720. END CATCH
  1721. GO
  1722. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event'  AND sc.name=N'dbo'  AND type in (N'U'))
  1723. BEGIN
  1724.  
  1725.   DECLARE @drop_statement nvarchar(500)
  1726.  
  1727.   DECLARE drop_cursor CURSOR FOR
  1728.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1729.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1730.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1731.       WHERE fk.referenced_object_id =
  1732.           (
  1733.              SELECT so.object_id
  1734.              FROM sys.objects so JOIN sys.schemas sc
  1735.              ON so.schema_id = sc.schema_id
  1736.              WHERE so.name = N'community_event'  AND sc.name=N'dbo'  AND type in (N'U')
  1737.            )
  1738.  
  1739.   OPEN drop_cursor
  1740.  
  1741.   FETCH NEXT FROM drop_cursor
  1742.   INTO @drop_statement
  1743.  
  1744.   WHILE @@FETCH_STATUS = 0
  1745.   BEGIN
  1746.      EXEC (@drop_statement)
  1747.  
  1748.      FETCH NEXT FROM drop_cursor
  1749.      INTO @drop_statement
  1750.   END
  1751.  
  1752.   CLOSE drop_cursor
  1753.   DEALLOCATE drop_cursor
  1754.  
  1755.   DROP TABLE [dbo].[community_event]
  1756. END
  1757. GO
  1758.  
  1759. SET ANSI_NULLS ON
  1760. GO
  1761. SET QUOTED_IDENTIFIER ON
  1762. GO
  1763. CREATE TABLE
  1764. [dbo].[community_event]
  1765. (
  1766.    [id] int IDENTITY(1, 1)  NOT NULL,
  1767.    [community_id] int  NOT NULL,
  1768.    [member_id] int DEFAULT NULL  NULL,
  1769.    [name] nvarchar(max)  NOT NULL,
  1770.    [body] nvarchar(max)  NOT NULL,
  1771.    [event_updated_at] datetime2(0) DEFAULT NULL  NULL,
  1772.    [open_date] datetime2(0)  NOT NULL,
  1773.    [open_date_comment] nvarchar(max)  NOT NULL,
  1774.    [area] nvarchar(max)  NOT NULL,
  1775.    [application_deadline] datetime2(0) DEFAULT NULL  NULL,
  1776.    [capacity] int DEFAULT NULL  NULL,
  1777.    [created_at] datetime2(0)  NOT NULL,
  1778.    [updated_at] datetime2(0)  NOT NULL
  1779. )
  1780. GO
  1781. BEGIN TRY
  1782.     EXEC sp_addextendedproperty
  1783.         N'MS_SSMA_SOURCE', N'dbo.community_event',
  1784.         N'SCHEMA', N'dbo',
  1785.         N'TABLE', N'community_event'
  1786. END TRY
  1787. BEGIN CATCH
  1788.     IF (@@TRANCOUNT > 0) ROLLBACK
  1789.     PRINT ERROR_MESSAGE()
  1790. END CATCH
  1791. GO
  1792. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_comment'  AND sc.name=N'dbo'  AND type in (N'U'))
  1793. BEGIN
  1794.  
  1795.   DECLARE @drop_statement nvarchar(500)
  1796.  
  1797.   DECLARE drop_cursor CURSOR FOR
  1798.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1799.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1800.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1801.       WHERE fk.referenced_object_id =
  1802.           (
  1803.              SELECT so.object_id
  1804.              FROM sys.objects so JOIN sys.schemas sc
  1805.              ON so.schema_id = sc.schema_id
  1806.              WHERE so.name = N'community_event_comment'  AND sc.name=N'dbo'  AND type in (N'U')
  1807.            )
  1808.  
  1809.   OPEN drop_cursor
  1810.  
  1811.   FETCH NEXT FROM drop_cursor
  1812.   INTO @drop_statement
  1813.  
  1814.   WHILE @@FETCH_STATUS = 0
  1815.   BEGIN
  1816.      EXEC (@drop_statement)
  1817.  
  1818.      FETCH NEXT FROM drop_cursor
  1819.      INTO @drop_statement
  1820.   END
  1821.  
  1822.   CLOSE drop_cursor
  1823.   DEALLOCATE drop_cursor
  1824.  
  1825.   DROP TABLE [dbo].[community_event_comment]
  1826. END
  1827. GO
  1828.  
  1829. SET ANSI_NULLS ON
  1830. GO
  1831. SET QUOTED_IDENTIFIER ON
  1832. GO
  1833. CREATE TABLE
  1834. [dbo].[community_event_comment]
  1835. (
  1836.    [id] int IDENTITY(1, 1)  NOT NULL,
  1837.    [community_event_id] int  NOT NULL,
  1838.    [member_id] int DEFAULT NULL  NULL,
  1839.  
  1840.    /*
  1841.    *   SSMA informational messages:
  1842.    *   M2SS0052: string literal was converted to NUMERIC literal
  1843.    */
  1844.  
  1845.    [number] int DEFAULT 0  NOT NULL,
  1846.    [body] nvarchar(max)  NOT NULL,
  1847.    [created_at] datetime2(0)  NOT NULL,
  1848.    [updated_at] datetime2(0)  NOT NULL
  1849. )
  1850. GO
  1851. BEGIN TRY
  1852.     EXEC sp_addextendedproperty
  1853.         N'MS_SSMA_SOURCE', N'dbo.community_event_comment',
  1854.         N'SCHEMA', N'dbo',
  1855.         N'TABLE', N'community_event_comment'
  1856. END TRY
  1857. BEGIN CATCH
  1858.     IF (@@TRANCOUNT > 0) ROLLBACK
  1859.     PRINT ERROR_MESSAGE()
  1860. END CATCH
  1861. GO
  1862. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_comment_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  1863. BEGIN
  1864.  
  1865.   DECLARE @drop_statement nvarchar(500)
  1866.  
  1867.   DECLARE drop_cursor CURSOR FOR
  1868.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1869.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1870.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1871.       WHERE fk.referenced_object_id =
  1872.           (
  1873.              SELECT so.object_id
  1874.              FROM sys.objects so JOIN sys.schemas sc
  1875.              ON so.schema_id = sc.schema_id
  1876.              WHERE so.name = N'community_event_comment_image'  AND sc.name=N'dbo'  AND type in (N'U')
  1877.            )
  1878.  
  1879.   OPEN drop_cursor
  1880.  
  1881.   FETCH NEXT FROM drop_cursor
  1882.   INTO @drop_statement
  1883.  
  1884.   WHILE @@FETCH_STATUS = 0
  1885.   BEGIN
  1886.      EXEC (@drop_statement)
  1887.  
  1888.      FETCH NEXT FROM drop_cursor
  1889.      INTO @drop_statement
  1890.   END
  1891.  
  1892.   CLOSE drop_cursor
  1893.   DEALLOCATE drop_cursor
  1894.  
  1895.   DROP TABLE [dbo].[community_event_comment_image]
  1896. END
  1897. GO
  1898.  
  1899. SET ANSI_NULLS ON
  1900. GO
  1901. SET QUOTED_IDENTIFIER ON
  1902. GO
  1903. CREATE TABLE
  1904. [dbo].[community_event_comment_image]
  1905. (
  1906.    [id] int IDENTITY(1, 1)  NOT NULL,
  1907.    [post_id] int  NOT NULL,
  1908.    [file_id] int DEFAULT NULL  NULL,
  1909.    [number] int  NOT NULL
  1910. )
  1911. GO
  1912. BEGIN TRY
  1913.     EXEC sp_addextendedproperty
  1914.         N'MS_SSMA_SOURCE', N'dbo.community_event_comment_image',
  1915.         N'SCHEMA', N'dbo',
  1916.         N'TABLE', N'community_event_comment_image'
  1917. END TRY
  1918. BEGIN CATCH
  1919.     IF (@@TRANCOUNT > 0) ROLLBACK
  1920.     PRINT ERROR_MESSAGE()
  1921. END CATCH
  1922. GO
  1923. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  1924. BEGIN
  1925.  
  1926.   DECLARE @drop_statement nvarchar(500)
  1927.  
  1928.   DECLARE drop_cursor CURSOR FOR
  1929.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1930.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1931.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1932.       WHERE fk.referenced_object_id =
  1933.           (
  1934.              SELECT so.object_id
  1935.              FROM sys.objects so JOIN sys.schemas sc
  1936.              ON so.schema_id = sc.schema_id
  1937.              WHERE so.name = N'community_event_image'  AND sc.name=N'dbo'  AND type in (N'U')
  1938.            )
  1939.  
  1940.   OPEN drop_cursor
  1941.  
  1942.   FETCH NEXT FROM drop_cursor
  1943.   INTO @drop_statement
  1944.  
  1945.   WHILE @@FETCH_STATUS = 0
  1946.   BEGIN
  1947.      EXEC (@drop_statement)
  1948.  
  1949.      FETCH NEXT FROM drop_cursor
  1950.      INTO @drop_statement
  1951.   END
  1952.  
  1953.   CLOSE drop_cursor
  1954.   DEALLOCATE drop_cursor
  1955.  
  1956.   DROP TABLE [dbo].[community_event_image]
  1957. END
  1958. GO
  1959.  
  1960. SET ANSI_NULLS ON
  1961. GO
  1962. SET QUOTED_IDENTIFIER ON
  1963. GO
  1964. CREATE TABLE
  1965. [dbo].[community_event_image]
  1966. (
  1967.    [id] int IDENTITY(1, 1)  NOT NULL,
  1968.    [post_id] int  NOT NULL,
  1969.    [file_id] int DEFAULT NULL  NULL,
  1970.    [number] int  NOT NULL
  1971. )
  1972. GO
  1973. BEGIN TRY
  1974.     EXEC sp_addextendedproperty
  1975.         N'MS_SSMA_SOURCE', N'dbo.community_event_image',
  1976.         N'SCHEMA', N'dbo',
  1977.         N'TABLE', N'community_event_image'
  1978. END TRY
  1979. BEGIN CATCH
  1980.     IF (@@TRANCOUNT > 0) ROLLBACK
  1981.     PRINT ERROR_MESSAGE()
  1982. END CATCH
  1983. GO
  1984. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_member'  AND sc.name=N'dbo'  AND type in (N'U'))
  1985. BEGIN
  1986.  
  1987.   DECLARE @drop_statement nvarchar(500)
  1988.  
  1989.   DECLARE drop_cursor CURSOR FOR
  1990.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  1991.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  1992.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  1993.       WHERE fk.referenced_object_id =
  1994.           (
  1995.              SELECT so.object_id
  1996.              FROM sys.objects so JOIN sys.schemas sc
  1997.              ON so.schema_id = sc.schema_id
  1998.              WHERE so.name = N'community_event_member'  AND sc.name=N'dbo'  AND type in (N'U')
  1999.            )
  2000.  
  2001.   OPEN drop_cursor
  2002.  
  2003.   FETCH NEXT FROM drop_cursor
  2004.   INTO @drop_statement
  2005.  
  2006.   WHILE @@FETCH_STATUS = 0
  2007.   BEGIN
  2008.      EXEC (@drop_statement)
  2009.  
  2010.      FETCH NEXT FROM drop_cursor
  2011.      INTO @drop_statement
  2012.   END
  2013.  
  2014.   CLOSE drop_cursor
  2015.   DEALLOCATE drop_cursor
  2016.  
  2017.   DROP TABLE [dbo].[community_event_member]
  2018. END
  2019. GO
  2020.  
  2021. SET ANSI_NULLS ON
  2022. GO
  2023. SET QUOTED_IDENTIFIER ON
  2024. GO
  2025. CREATE TABLE
  2026. [dbo].[community_event_member]
  2027. (
  2028.    [id] int IDENTITY(1, 1)  NOT NULL,
  2029.    [community_event_id] int  NOT NULL,
  2030.    [member_id] int  NOT NULL,
  2031.    [created_at] datetime2(0)  NOT NULL,
  2032.    [updated_at] datetime2(0)  NOT NULL
  2033. )
  2034. GO
  2035. BEGIN TRY
  2036.     EXEC sp_addextendedproperty
  2037.         N'MS_SSMA_SOURCE', N'dbo.community_event_member',
  2038.         N'SCHEMA', N'dbo',
  2039.         N'TABLE', N'community_event_member'
  2040. END TRY
  2041. BEGIN CATCH
  2042.     IF (@@TRANCOUNT > 0) ROLLBACK
  2043.     PRINT ERROR_MESSAGE()
  2044. END CATCH
  2045. GO
  2046. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_member'  AND sc.name=N'dbo'  AND type in (N'U'))
  2047. BEGIN
  2048.  
  2049.   DECLARE @drop_statement nvarchar(500)
  2050.  
  2051.   DECLARE drop_cursor CURSOR FOR
  2052.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2053.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2054.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2055.       WHERE fk.referenced_object_id =
  2056.           (
  2057.              SELECT so.object_id
  2058.              FROM sys.objects so JOIN sys.schemas sc
  2059.              ON so.schema_id = sc.schema_id
  2060.              WHERE so.name = N'community_member'  AND sc.name=N'dbo'  AND type in (N'U')
  2061.            )
  2062.  
  2063.   OPEN drop_cursor
  2064.  
  2065.   FETCH NEXT FROM drop_cursor
  2066.   INTO @drop_statement
  2067.  
  2068.   WHILE @@FETCH_STATUS = 0
  2069.   BEGIN
  2070.      EXEC (@drop_statement)
  2071.  
  2072.      FETCH NEXT FROM drop_cursor
  2073.      INTO @drop_statement
  2074.   END
  2075.  
  2076.   CLOSE drop_cursor
  2077.   DEALLOCATE drop_cursor
  2078.  
  2079.   DROP TABLE [dbo].[community_member]
  2080. END
  2081. GO
  2082.  
  2083. SET ANSI_NULLS ON
  2084. GO
  2085. SET QUOTED_IDENTIFIER ON
  2086. GO
  2087. CREATE TABLE
  2088. [dbo].[community_member]
  2089. (
  2090.  
  2091.    /*
  2092.    *   SSMA informational messages:
  2093.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  2094.    */
  2095.  
  2096.    [id] int IDENTITY(1, 1)  NOT NULL,
  2097.  
  2098.    /*
  2099.    *   SSMA informational messages:
  2100.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Community id'.
  2101.    */
  2102.  
  2103.    [community_id] int  NOT NULL,
  2104.  
  2105.    /*
  2106.    *   SSMA informational messages:
  2107.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  2108.    */
  2109.  
  2110.    [member_id] int  NOT NULL,
  2111.  
  2112.    /*
  2113.    *   SSMA informational messages:
  2114.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Is pre member?'.
  2115.    *   M2SS0052: string literal was converted to NUMERIC literal
  2116.    */
  2117.  
  2118.    [is_pre] smallint DEFAULT 0  NOT NULL,
  2119.  
  2120.    /*
  2121.    *   SSMA informational messages:
  2122.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Notification of posting in community by computer E-mail.'.
  2123.    *   M2SS0052: string literal was converted to NUMERIC literal
  2124.    */
  2125.  
  2126.    [is_receive_mail_pc] smallint DEFAULT 0  NOT NULL,
  2127.  
  2128.    /*
  2129.    *   SSMA informational messages:
  2130.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Notification of posting in community by mobile E-mail.'.
  2131.    *   M2SS0052: string literal was converted to NUMERIC literal
  2132.    */
  2133.  
  2134.    [is_receive_mail_mobile] smallint DEFAULT 0  NOT NULL,
  2135.    [created_at] datetime2(0)  NOT NULL,
  2136.    [updated_at] datetime2(0)  NOT NULL
  2137. )
  2138. GO
  2139. BEGIN TRY
  2140.     EXEC sp_addextendedproperty
  2141.         N'MS_SSMA_SOURCE', N'dbo.community_member',
  2142.         N'SCHEMA', N'dbo',
  2143.         N'TABLE', N'community_member'
  2144. END TRY
  2145. BEGIN CATCH
  2146.     IF (@@TRANCOUNT > 0) ROLLBACK
  2147.     PRINT ERROR_MESSAGE()
  2148. END CATCH
  2149. GO
  2150. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_member_position'  AND sc.name=N'dbo'  AND type in (N'U'))
  2151. BEGIN
  2152.  
  2153.   DECLARE @drop_statement nvarchar(500)
  2154.  
  2155.   DECLARE drop_cursor CURSOR FOR
  2156.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2157.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2158.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2159.       WHERE fk.referenced_object_id =
  2160.           (
  2161.              SELECT so.object_id
  2162.              FROM sys.objects so JOIN sys.schemas sc
  2163.              ON so.schema_id = sc.schema_id
  2164.              WHERE so.name = N'community_member_position'  AND sc.name=N'dbo'  AND type in (N'U')
  2165.            )
  2166.  
  2167.   OPEN drop_cursor
  2168.  
  2169.   FETCH NEXT FROM drop_cursor
  2170.   INTO @drop_statement
  2171.  
  2172.   WHILE @@FETCH_STATUS = 0
  2173.   BEGIN
  2174.      EXEC (@drop_statement)
  2175.  
  2176.      FETCH NEXT FROM drop_cursor
  2177.      INTO @drop_statement
  2178.   END
  2179.  
  2180.   CLOSE drop_cursor
  2181.   DEALLOCATE drop_cursor
  2182.  
  2183.   DROP TABLE [dbo].[community_member_position]
  2184. END
  2185. GO
  2186.  
  2187. SET ANSI_NULLS ON
  2188. GO
  2189. SET QUOTED_IDENTIFIER ON
  2190. GO
  2191. CREATE TABLE
  2192. [dbo].[community_member_position]
  2193. (
  2194.  
  2195.    /*
  2196.    *   SSMA informational messages:
  2197.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  2198.    */
  2199.  
  2200.    [id] int IDENTITY(1, 1)  NOT NULL,
  2201.  
  2202.    /*
  2203.    *   SSMA informational messages:
  2204.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Community id'.
  2205.    */
  2206.  
  2207.    [community_id] int  NOT NULL,
  2208.  
  2209.    /*
  2210.    *   SSMA informational messages:
  2211.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  2212.    */
  2213.  
  2214.    [member_id] int  NOT NULL,
  2215.  
  2216.    /*
  2217.    *   SSMA informational messages:
  2218.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Community Member id'.
  2219.    */
  2220.  
  2221.    [community_member_id] int  NOT NULL,
  2222.  
  2223.    /*
  2224.    *   SSMA warning messages:
  2225.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  2226.  
  2227.    *   SSMA informational messages:
  2228.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member''s position name in this community'.
  2229.    */
  2230.  
  2231.    [name] nvarchar(32)  NOT NULL,
  2232.    [created_at] datetime2(0)  NOT NULL,
  2233.    [updated_at] datetime2(0)  NOT NULL
  2234. )
  2235. GO
  2236. BEGIN TRY
  2237.     EXEC sp_addextendedproperty
  2238.         N'MS_SSMA_SOURCE', N'dbo.community_member_position',
  2239.         N'SCHEMA', N'dbo',
  2240.         N'TABLE', N'community_member_position'
  2241. END TRY
  2242. BEGIN CATCH
  2243.     IF (@@TRANCOUNT > 0) ROLLBACK
  2244.     PRINT ERROR_MESSAGE()
  2245. END CATCH
  2246. GO
  2247. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic'  AND sc.name=N'dbo'  AND type in (N'U'))
  2248. BEGIN
  2249.  
  2250.   DECLARE @drop_statement nvarchar(500)
  2251.  
  2252.   DECLARE drop_cursor CURSOR FOR
  2253.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2254.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2255.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2256.       WHERE fk.referenced_object_id =
  2257.           (
  2258.              SELECT so.object_id
  2259.              FROM sys.objects so JOIN sys.schemas sc
  2260.              ON so.schema_id = sc.schema_id
  2261.              WHERE so.name = N'community_topic'  AND sc.name=N'dbo'  AND type in (N'U')
  2262.            )
  2263.  
  2264.   OPEN drop_cursor
  2265.  
  2266.   FETCH NEXT FROM drop_cursor
  2267.   INTO @drop_statement
  2268.  
  2269.   WHILE @@FETCH_STATUS = 0
  2270.   BEGIN
  2271.      EXEC (@drop_statement)
  2272.  
  2273.      FETCH NEXT FROM drop_cursor
  2274.      INTO @drop_statement
  2275.   END
  2276.  
  2277.   CLOSE drop_cursor
  2278.   DEALLOCATE drop_cursor
  2279.  
  2280.   DROP TABLE [dbo].[community_topic]
  2281. END
  2282. GO
  2283.  
  2284. SET ANSI_NULLS ON
  2285. GO
  2286. SET QUOTED_IDENTIFIER ON
  2287. GO
  2288. CREATE TABLE
  2289. [dbo].[community_topic]
  2290. (
  2291.    [id] int IDENTITY(1, 1)  NOT NULL,
  2292.    [community_id] int  NOT NULL,
  2293.    [member_id] int DEFAULT NULL  NULL,
  2294.    [name] nvarchar(max)  NOT NULL,
  2295.    [body] nvarchar(max)  NOT NULL,
  2296.    [topic_updated_at] datetime2(0) DEFAULT NULL  NULL,
  2297.    [created_at] datetime2(0)  NOT NULL,
  2298.    [updated_at] datetime2(0)  NOT NULL
  2299. )
  2300. GO
  2301. BEGIN TRY
  2302.     EXEC sp_addextendedproperty
  2303.         N'MS_SSMA_SOURCE', N'dbo.community_topic',
  2304.         N'SCHEMA', N'dbo',
  2305.         N'TABLE', N'community_topic'
  2306. END TRY
  2307. BEGIN CATCH
  2308.     IF (@@TRANCOUNT > 0) ROLLBACK
  2309.     PRINT ERROR_MESSAGE()
  2310. END CATCH
  2311. GO
  2312. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_comment'  AND sc.name=N'dbo'  AND type in (N'U'))
  2313. BEGIN
  2314.  
  2315.   DECLARE @drop_statement nvarchar(500)
  2316.  
  2317.   DECLARE drop_cursor CURSOR FOR
  2318.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2319.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2320.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2321.       WHERE fk.referenced_object_id =
  2322.           (
  2323.              SELECT so.object_id
  2324.              FROM sys.objects so JOIN sys.schemas sc
  2325.              ON so.schema_id = sc.schema_id
  2326.              WHERE so.name = N'community_topic_comment'  AND sc.name=N'dbo'  AND type in (N'U')
  2327.            )
  2328.  
  2329.   OPEN drop_cursor
  2330.  
  2331.   FETCH NEXT FROM drop_cursor
  2332.   INTO @drop_statement
  2333.  
  2334.   WHILE @@FETCH_STATUS = 0
  2335.   BEGIN
  2336.      EXEC (@drop_statement)
  2337.  
  2338.      FETCH NEXT FROM drop_cursor
  2339.      INTO @drop_statement
  2340.   END
  2341.  
  2342.   CLOSE drop_cursor
  2343.   DEALLOCATE drop_cursor
  2344.  
  2345.   DROP TABLE [dbo].[community_topic_comment]
  2346. END
  2347. GO
  2348.  
  2349. SET ANSI_NULLS ON
  2350. GO
  2351. SET QUOTED_IDENTIFIER ON
  2352. GO
  2353. CREATE TABLE
  2354. [dbo].[community_topic_comment]
  2355. (
  2356.    [id] int IDENTITY(1, 1)  NOT NULL,
  2357.    [community_topic_id] int  NOT NULL,
  2358.    [member_id] int DEFAULT NULL  NULL,
  2359.  
  2360.    /*
  2361.    *   SSMA informational messages:
  2362.    *   M2SS0052: string literal was converted to NUMERIC literal
  2363.    */
  2364.  
  2365.    [number] int DEFAULT 0  NOT NULL,
  2366.    [body] nvarchar(max)  NOT NULL,
  2367.    [created_at] datetime2(0)  NOT NULL,
  2368.    [updated_at] datetime2(0)  NOT NULL
  2369. )
  2370. GO
  2371. BEGIN TRY
  2372.     EXEC sp_addextendedproperty
  2373.         N'MS_SSMA_SOURCE', N'dbo.community_topic_comment',
  2374.         N'SCHEMA', N'dbo',
  2375.         N'TABLE', N'community_topic_comment'
  2376. END TRY
  2377. BEGIN CATCH
  2378.     IF (@@TRANCOUNT > 0) ROLLBACK
  2379.     PRINT ERROR_MESSAGE()
  2380. END CATCH
  2381. GO
  2382. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_comment_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  2383. BEGIN
  2384.  
  2385.   DECLARE @drop_statement nvarchar(500)
  2386.  
  2387.   DECLARE drop_cursor CURSOR FOR
  2388.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2389.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2390.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2391.       WHERE fk.referenced_object_id =
  2392.           (
  2393.              SELECT so.object_id
  2394.              FROM sys.objects so JOIN sys.schemas sc
  2395.              ON so.schema_id = sc.schema_id
  2396.              WHERE so.name = N'community_topic_comment_image'  AND sc.name=N'dbo'  AND type in (N'U')
  2397.            )
  2398.  
  2399.   OPEN drop_cursor
  2400.  
  2401.   FETCH NEXT FROM drop_cursor
  2402.   INTO @drop_statement
  2403.  
  2404.   WHILE @@FETCH_STATUS = 0
  2405.   BEGIN
  2406.      EXEC (@drop_statement)
  2407.  
  2408.      FETCH NEXT FROM drop_cursor
  2409.      INTO @drop_statement
  2410.   END
  2411.  
  2412.   CLOSE drop_cursor
  2413.   DEALLOCATE drop_cursor
  2414.  
  2415.   DROP TABLE [dbo].[community_topic_comment_image]
  2416. END
  2417. GO
  2418.  
  2419. SET ANSI_NULLS ON
  2420. GO
  2421. SET QUOTED_IDENTIFIER ON
  2422. GO
  2423. CREATE TABLE
  2424. [dbo].[community_topic_comment_image]
  2425. (
  2426.    [id] int IDENTITY(1, 1)  NOT NULL,
  2427.    [post_id] int  NOT NULL,
  2428.    [file_id] int DEFAULT NULL  NULL,
  2429.    [number] int  NOT NULL
  2430. )
  2431. GO
  2432. BEGIN TRY
  2433.     EXEC sp_addextendedproperty
  2434.         N'MS_SSMA_SOURCE', N'dbo.community_topic_comment_image',
  2435.         N'SCHEMA', N'dbo',
  2436.         N'TABLE', N'community_topic_comment_image'
  2437. END TRY
  2438. BEGIN CATCH
  2439.     IF (@@TRANCOUNT > 0) ROLLBACK
  2440.     PRINT ERROR_MESSAGE()
  2441. END CATCH
  2442. GO
  2443. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  2444. BEGIN
  2445.  
  2446.   DECLARE @drop_statement nvarchar(500)
  2447.  
  2448.   DECLARE drop_cursor CURSOR FOR
  2449.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2450.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2451.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2452.       WHERE fk.referenced_object_id =
  2453.           (
  2454.              SELECT so.object_id
  2455.              FROM sys.objects so JOIN sys.schemas sc
  2456.              ON so.schema_id = sc.schema_id
  2457.              WHERE so.name = N'community_topic_image'  AND sc.name=N'dbo'  AND type in (N'U')
  2458.            )
  2459.  
  2460.   OPEN drop_cursor
  2461.  
  2462.   FETCH NEXT FROM drop_cursor
  2463.   INTO @drop_statement
  2464.  
  2465.   WHILE @@FETCH_STATUS = 0
  2466.   BEGIN
  2467.      EXEC (@drop_statement)
  2468.  
  2469.      FETCH NEXT FROM drop_cursor
  2470.      INTO @drop_statement
  2471.   END
  2472.  
  2473.   CLOSE drop_cursor
  2474.   DEALLOCATE drop_cursor
  2475.  
  2476.   DROP TABLE [dbo].[community_topic_image]
  2477. END
  2478. GO
  2479.  
  2480. SET ANSI_NULLS ON
  2481. GO
  2482. SET QUOTED_IDENTIFIER ON
  2483. GO
  2484. CREATE TABLE
  2485. [dbo].[community_topic_image]
  2486. (
  2487.    [id] int IDENTITY(1, 1)  NOT NULL,
  2488.    [post_id] int  NOT NULL,
  2489.    [file_id] int DEFAULT NULL  NULL,
  2490.    [number] int  NOT NULL
  2491. )
  2492. GO
  2493. BEGIN TRY
  2494.     EXEC sp_addextendedproperty
  2495.         N'MS_SSMA_SOURCE', N'dbo.community_topic_image',
  2496.         N'SCHEMA', N'dbo',
  2497.         N'TABLE', N'community_topic_image'
  2498. END TRY
  2499. BEGIN CATCH
  2500.     IF (@@TRANCOUNT > 0) ROLLBACK
  2501.     PRINT ERROR_MESSAGE()
  2502. END CATCH
  2503. GO
  2504. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'deleted_message'  AND sc.name=N'dbo'  AND type in (N'U'))
  2505. BEGIN
  2506.  
  2507.   DECLARE @drop_statement nvarchar(500)
  2508.  
  2509.   DECLARE drop_cursor CURSOR FOR
  2510.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2511.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2512.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2513.       WHERE fk.referenced_object_id =
  2514.           (
  2515.              SELECT so.object_id
  2516.              FROM sys.objects so JOIN sys.schemas sc
  2517.              ON so.schema_id = sc.schema_id
  2518.              WHERE so.name = N'deleted_message'  AND sc.name=N'dbo'  AND type in (N'U')
  2519.            )
  2520.  
  2521.   OPEN drop_cursor
  2522.  
  2523.   FETCH NEXT FROM drop_cursor
  2524.   INTO @drop_statement
  2525.  
  2526.   WHILE @@FETCH_STATUS = 0
  2527.   BEGIN
  2528.      EXEC (@drop_statement)
  2529.  
  2530.      FETCH NEXT FROM drop_cursor
  2531.      INTO @drop_statement
  2532.   END
  2533.  
  2534.   CLOSE drop_cursor
  2535.   DEALLOCATE drop_cursor
  2536.  
  2537.   DROP TABLE [dbo].[deleted_message]
  2538. END
  2539. GO
  2540.  
  2541. SET ANSI_NULLS ON
  2542. GO
  2543. SET QUOTED_IDENTIFIER ON
  2544. GO
  2545. CREATE TABLE
  2546. [dbo].[deleted_message]
  2547. (
  2548.    [id] int IDENTITY(1, 1)  NOT NULL,
  2549.    [member_id] int DEFAULT NULL  NULL,
  2550.    [message_id] int  NOT NULL,
  2551.    [message_send_list_id] int  NOT NULL,
  2552.  
  2553.    /*
  2554.    *   SSMA informational messages:
  2555.    *   M2SS0052: string literal was converted to NUMERIC literal
  2556.    */
  2557.  
  2558.    [is_deleted] smallint DEFAULT 0  NOT NULL,
  2559.    [created_at] datetime2(0)  NOT NULL,
  2560.    [updated_at] datetime2(0)  NOT NULL
  2561. )
  2562. GO
  2563. BEGIN TRY
  2564.     EXEC sp_addextendedproperty
  2565.         N'MS_SSMA_SOURCE', N'dbo.deleted_message',
  2566.         N'SCHEMA', N'dbo',
  2567.         N'TABLE', N'deleted_message'
  2568. END TRY
  2569. BEGIN CATCH
  2570.     IF (@@TRANCOUNT > 0) ROLLBACK
  2571.     PRINT ERROR_MESSAGE()
  2572. END CATCH
  2573. GO
  2574. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary'  AND sc.name=N'dbo'  AND type in (N'U'))
  2575. BEGIN
  2576.  
  2577.   DECLARE @drop_statement nvarchar(500)
  2578.  
  2579.   DECLARE drop_cursor CURSOR FOR
  2580.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2581.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2582.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2583.       WHERE fk.referenced_object_id =
  2584.           (
  2585.              SELECT so.object_id
  2586.              FROM sys.objects so JOIN sys.schemas sc
  2587.              ON so.schema_id = sc.schema_id
  2588.              WHERE so.name = N'diary'  AND sc.name=N'dbo'  AND type in (N'U')
  2589.            )
  2590.  
  2591.   OPEN drop_cursor
  2592.  
  2593.   FETCH NEXT FROM drop_cursor
  2594.   INTO @drop_statement
  2595.  
  2596.   WHILE @@FETCH_STATUS = 0
  2597.   BEGIN
  2598.      EXEC (@drop_statement)
  2599.  
  2600.      FETCH NEXT FROM drop_cursor
  2601.      INTO @drop_statement
  2602.   END
  2603.  
  2604.   CLOSE drop_cursor
  2605.   DEALLOCATE drop_cursor
  2606.  
  2607.   DROP TABLE [dbo].[diary]
  2608. END
  2609. GO
  2610.  
  2611. SET ANSI_NULLS ON
  2612. GO
  2613. SET QUOTED_IDENTIFIER ON
  2614. GO
  2615. CREATE TABLE
  2616. [dbo].[diary]
  2617. (
  2618.    [id] int IDENTITY(1, 1)  NOT NULL,
  2619.    [member_id] int  NOT NULL,
  2620.    [title] nvarchar(max)  NOT NULL,
  2621.    [body] nvarchar(max)  NOT NULL,
  2622.  
  2623.    /*
  2624.    *   SSMA informational messages:
  2625.    *   M2SS0052: string literal was converted to NUMERIC literal
  2626.    */
  2627.  
  2628.    [public_flag] smallint DEFAULT 1  NOT NULL,
  2629.  
  2630.    /*
  2631.    *   SSMA informational messages:
  2632.    *   M2SS0052: string literal was converted to NUMERIC literal
  2633.    */
  2634.  
  2635.    [is_open] smallint DEFAULT 0  NOT NULL,
  2636.  
  2637.    /*
  2638.    *   SSMA informational messages:
  2639.    *   M2SS0052: string literal was converted to NUMERIC literal
  2640.    */
  2641.  
  2642.    [has_images] smallint DEFAULT 0  NOT NULL,
  2643.    [created_at] datetime2(0)  NOT NULL,
  2644.    [updated_at] datetime2(0)  NOT NULL
  2645. )
  2646. GO
  2647. BEGIN TRY
  2648.     EXEC sp_addextendedproperty
  2649.         N'MS_SSMA_SOURCE', N'dbo.diary',
  2650.         N'SCHEMA', N'dbo',
  2651.         N'TABLE', N'diary'
  2652. END TRY
  2653. BEGIN CATCH
  2654.     IF (@@TRANCOUNT > 0) ROLLBACK
  2655.     PRINT ERROR_MESSAGE()
  2656. END CATCH
  2657. GO
  2658. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment'  AND sc.name=N'dbo'  AND type in (N'U'))
  2659. BEGIN
  2660.  
  2661.   DECLARE @drop_statement nvarchar(500)
  2662.  
  2663.   DECLARE drop_cursor CURSOR FOR
  2664.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2665.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2666.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2667.       WHERE fk.referenced_object_id =
  2668.           (
  2669.              SELECT so.object_id
  2670.              FROM sys.objects so JOIN sys.schemas sc
  2671.              ON so.schema_id = sc.schema_id
  2672.              WHERE so.name = N'diary_comment'  AND sc.name=N'dbo'  AND type in (N'U')
  2673.            )
  2674.  
  2675.   OPEN drop_cursor
  2676.  
  2677.   FETCH NEXT FROM drop_cursor
  2678.   INTO @drop_statement
  2679.  
  2680.   WHILE @@FETCH_STATUS = 0
  2681.   BEGIN
  2682.      EXEC (@drop_statement)
  2683.  
  2684.      FETCH NEXT FROM drop_cursor
  2685.      INTO @drop_statement
  2686.   END
  2687.  
  2688.   CLOSE drop_cursor
  2689.   DEALLOCATE drop_cursor
  2690.  
  2691.   DROP TABLE [dbo].[diary_comment]
  2692. END
  2693. GO
  2694.  
  2695. SET ANSI_NULLS ON
  2696. GO
  2697. SET QUOTED_IDENTIFIER ON
  2698. GO
  2699. CREATE TABLE
  2700. [dbo].[diary_comment]
  2701. (
  2702.    [id] int IDENTITY(1, 1)  NOT NULL,
  2703.    [diary_id] int  NOT NULL,
  2704.    [member_id] int  NOT NULL,
  2705.    [number] int  NOT NULL,
  2706.    [body] nvarchar(max)  NOT NULL,
  2707.  
  2708.    /*
  2709.    *   SSMA informational messages:
  2710.    *   M2SS0052: string literal was converted to NUMERIC literal
  2711.    */
  2712.  
  2713.    [has_images] smallint DEFAULT 0  NOT NULL,
  2714.    [created_at] datetime2(0)  NOT NULL,
  2715.    [updated_at] datetime2(0)  NOT NULL
  2716. )
  2717. GO
  2718. BEGIN TRY
  2719.     EXEC sp_addextendedproperty
  2720.         N'MS_SSMA_SOURCE', N'dbo.diary_comment',
  2721.         N'SCHEMA', N'dbo',
  2722.         N'TABLE', N'diary_comment'
  2723. END TRY
  2724. BEGIN CATCH
  2725.     IF (@@TRANCOUNT > 0) ROLLBACK
  2726.     PRINT ERROR_MESSAGE()
  2727. END CATCH
  2728. GO
  2729. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  2730. BEGIN
  2731.  
  2732.   DECLARE @drop_statement nvarchar(500)
  2733.  
  2734.   DECLARE drop_cursor CURSOR FOR
  2735.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2736.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2737.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2738.       WHERE fk.referenced_object_id =
  2739.           (
  2740.              SELECT so.object_id
  2741.              FROM sys.objects so JOIN sys.schemas sc
  2742.              ON so.schema_id = sc.schema_id
  2743.              WHERE so.name = N'diary_comment_image'  AND sc.name=N'dbo'  AND type in (N'U')
  2744.            )
  2745.  
  2746.   OPEN drop_cursor
  2747.  
  2748.   FETCH NEXT FROM drop_cursor
  2749.   INTO @drop_statement
  2750.  
  2751.   WHILE @@FETCH_STATUS = 0
  2752.   BEGIN
  2753.      EXEC (@drop_statement)
  2754.  
  2755.      FETCH NEXT FROM drop_cursor
  2756.      INTO @drop_statement
  2757.   END
  2758.  
  2759.   CLOSE drop_cursor
  2760.   DEALLOCATE drop_cursor
  2761.  
  2762.   DROP TABLE [dbo].[diary_comment_image]
  2763. END
  2764. GO
  2765.  
  2766. SET ANSI_NULLS ON
  2767. GO
  2768. SET QUOTED_IDENTIFIER ON
  2769. GO
  2770. CREATE TABLE
  2771. [dbo].[diary_comment_image]
  2772. (
  2773.    [id] int IDENTITY(1, 1)  NOT NULL,
  2774.    [diary_comment_id] int  NOT NULL,
  2775.    [file_id] int  NOT NULL
  2776. )
  2777. GO
  2778. BEGIN TRY
  2779.     EXEC sp_addextendedproperty
  2780.         N'MS_SSMA_SOURCE', N'dbo.diary_comment_image',
  2781.         N'SCHEMA', N'dbo',
  2782.         N'TABLE', N'diary_comment_image'
  2783. END TRY
  2784. BEGIN CATCH
  2785.     IF (@@TRANCOUNT > 0) ROLLBACK
  2786.     PRINT ERROR_MESSAGE()
  2787. END CATCH
  2788. GO
  2789. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_unread'  AND sc.name=N'dbo'  AND type in (N'U'))
  2790. BEGIN
  2791.  
  2792.   DECLARE @drop_statement nvarchar(500)
  2793.  
  2794.   DECLARE drop_cursor CURSOR FOR
  2795.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2796.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2797.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2798.       WHERE fk.referenced_object_id =
  2799.           (
  2800.              SELECT so.object_id
  2801.              FROM sys.objects so JOIN sys.schemas sc
  2802.              ON so.schema_id = sc.schema_id
  2803.              WHERE so.name = N'diary_comment_unread'  AND sc.name=N'dbo'  AND type in (N'U')
  2804.            )
  2805.  
  2806.   OPEN drop_cursor
  2807.  
  2808.   FETCH NEXT FROM drop_cursor
  2809.   INTO @drop_statement
  2810.  
  2811.   WHILE @@FETCH_STATUS = 0
  2812.   BEGIN
  2813.      EXEC (@drop_statement)
  2814.  
  2815.      FETCH NEXT FROM drop_cursor
  2816.      INTO @drop_statement
  2817.   END
  2818.  
  2819.   CLOSE drop_cursor
  2820.   DEALLOCATE drop_cursor
  2821.  
  2822.   DROP TABLE [dbo].[diary_comment_unread]
  2823. END
  2824. GO
  2825.  
  2826. SET ANSI_NULLS ON
  2827. GO
  2828. SET QUOTED_IDENTIFIER ON
  2829. GO
  2830. CREATE TABLE
  2831. [dbo].[diary_comment_unread]
  2832. (
  2833.  
  2834.    /*
  2835.    *   SSMA informational messages:
  2836.    *   M2SS0052: string literal was converted to NUMERIC literal
  2837.    */
  2838.  
  2839.    [diary_id] int DEFAULT 0  NOT NULL,
  2840.    [member_id] int  NOT NULL
  2841. )
  2842. GO
  2843. BEGIN TRY
  2844.     EXEC sp_addextendedproperty
  2845.         N'MS_SSMA_SOURCE', N'dbo.diary_comment_unread',
  2846.         N'SCHEMA', N'dbo',
  2847.         N'TABLE', N'diary_comment_unread'
  2848. END TRY
  2849. BEGIN CATCH
  2850.     IF (@@TRANCOUNT > 0) ROLLBACK
  2851.     PRINT ERROR_MESSAGE()
  2852. END CATCH
  2853. GO
  2854. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_update'  AND sc.name=N'dbo'  AND type in (N'U'))
  2855. BEGIN
  2856.  
  2857.   DECLARE @drop_statement nvarchar(500)
  2858.  
  2859.   DECLARE drop_cursor CURSOR FOR
  2860.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2861.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2862.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2863.       WHERE fk.referenced_object_id =
  2864.           (
  2865.              SELECT so.object_id
  2866.              FROM sys.objects so JOIN sys.schemas sc
  2867.              ON so.schema_id = sc.schema_id
  2868.              WHERE so.name = N'diary_comment_update'  AND sc.name=N'dbo'  AND type in (N'U')
  2869.            )
  2870.  
  2871.   OPEN drop_cursor
  2872.  
  2873.   FETCH NEXT FROM drop_cursor
  2874.   INTO @drop_statement
  2875.  
  2876.   WHILE @@FETCH_STATUS = 0
  2877.   BEGIN
  2878.      EXEC (@drop_statement)
  2879.  
  2880.      FETCH NEXT FROM drop_cursor
  2881.      INTO @drop_statement
  2882.   END
  2883.  
  2884.   CLOSE drop_cursor
  2885.   DEALLOCATE drop_cursor
  2886.  
  2887.   DROP TABLE [dbo].[diary_comment_update]
  2888. END
  2889. GO
  2890.  
  2891. SET ANSI_NULLS ON
  2892. GO
  2893. SET QUOTED_IDENTIFIER ON
  2894. GO
  2895. CREATE TABLE
  2896. [dbo].[diary_comment_update]
  2897. (
  2898.  
  2899.    /*
  2900.    *   SSMA informational messages:
  2901.    *   M2SS0052: string literal was converted to NUMERIC literal
  2902.    */
  2903.  
  2904.    [diary_id] int DEFAULT 0  NOT NULL,
  2905.  
  2906.    /*
  2907.    *   SSMA informational messages:
  2908.    *   M2SS0052: string literal was converted to NUMERIC literal
  2909.    */
  2910.  
  2911.    [member_id] int DEFAULT 0  NOT NULL,
  2912.    [last_comment_time] datetime2(0)  NOT NULL,
  2913.    [my_last_comment_time] datetime2(0)  NOT NULL
  2914. )
  2915. GO
  2916. BEGIN TRY
  2917.     EXEC sp_addextendedproperty
  2918.         N'MS_SSMA_SOURCE', N'dbo.diary_comment_update',
  2919.         N'SCHEMA', N'dbo',
  2920.         N'TABLE', N'diary_comment_update'
  2921. END TRY
  2922. BEGIN CATCH
  2923.     IF (@@TRANCOUNT > 0) ROLLBACK
  2924.     PRINT ERROR_MESSAGE()
  2925. END CATCH
  2926. GO
  2927. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  2928. BEGIN
  2929.  
  2930.   DECLARE @drop_statement nvarchar(500)
  2931.  
  2932.   DECLARE drop_cursor CURSOR FOR
  2933.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2934.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2935.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2936.       WHERE fk.referenced_object_id =
  2937.           (
  2938.              SELECT so.object_id
  2939.              FROM sys.objects so JOIN sys.schemas sc
  2940.              ON so.schema_id = sc.schema_id
  2941.              WHERE so.name = N'diary_image'  AND sc.name=N'dbo'  AND type in (N'U')
  2942.            )
  2943.  
  2944.   OPEN drop_cursor
  2945.  
  2946.   FETCH NEXT FROM drop_cursor
  2947.   INTO @drop_statement
  2948.  
  2949.   WHILE @@FETCH_STATUS = 0
  2950.   BEGIN
  2951.      EXEC (@drop_statement)
  2952.  
  2953.      FETCH NEXT FROM drop_cursor
  2954.      INTO @drop_statement
  2955.   END
  2956.  
  2957.   CLOSE drop_cursor
  2958.   DEALLOCATE drop_cursor
  2959.  
  2960.   DROP TABLE [dbo].[diary_image]
  2961. END
  2962. GO
  2963.  
  2964. SET ANSI_NULLS ON
  2965. GO
  2966. SET QUOTED_IDENTIFIER ON
  2967. GO
  2968. CREATE TABLE
  2969. [dbo].[diary_image]
  2970. (
  2971.    [id] int IDENTITY(1, 1)  NOT NULL,
  2972.    [diary_id] int  NOT NULL,
  2973.    [file_id] int  NOT NULL,
  2974.    [number] int  NOT NULL
  2975. )
  2976. GO
  2977. BEGIN TRY
  2978.     EXEC sp_addextendedproperty
  2979.         N'MS_SSMA_SOURCE', N'dbo.diary_image',
  2980.         N'SCHEMA', N'dbo',
  2981.         N'TABLE', N'diary_image'
  2982. END TRY
  2983. BEGIN CATCH
  2984.     IF (@@TRANCOUNT > 0) ROLLBACK
  2985.     PRINT ERROR_MESSAGE()
  2986. END CATCH
  2987. GO
  2988. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'favorite'  AND sc.name=N'dbo'  AND type in (N'U'))
  2989. BEGIN
  2990.  
  2991.   DECLARE @drop_statement nvarchar(500)
  2992.  
  2993.   DECLARE drop_cursor CURSOR FOR
  2994.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  2995.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  2996.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  2997.       WHERE fk.referenced_object_id =
  2998.           (
  2999.              SELECT so.object_id
  3000.              FROM sys.objects so JOIN sys.schemas sc
  3001.              ON so.schema_id = sc.schema_id
  3002.              WHERE so.name = N'favorite'  AND sc.name=N'dbo'  AND type in (N'U')
  3003.            )
  3004.  
  3005.   OPEN drop_cursor
  3006.  
  3007.   FETCH NEXT FROM drop_cursor
  3008.   INTO @drop_statement
  3009.  
  3010.   WHILE @@FETCH_STATUS = 0
  3011.   BEGIN
  3012.      EXEC (@drop_statement)
  3013.  
  3014.      FETCH NEXT FROM drop_cursor
  3015.      INTO @drop_statement
  3016.   END
  3017.  
  3018.   CLOSE drop_cursor
  3019.   DEALLOCATE drop_cursor
  3020.  
  3021.   DROP TABLE [dbo].[favorite]
  3022. END
  3023. GO
  3024.  
  3025. SET ANSI_NULLS ON
  3026. GO
  3027. SET QUOTED_IDENTIFIER ON
  3028. GO
  3029. CREATE TABLE
  3030. [dbo].[favorite]
  3031. (
  3032.    [id] int IDENTITY(1, 1)  NOT NULL,
  3033.    [member_id_to] int  NOT NULL,
  3034.    [member_id_from] int  NOT NULL,
  3035.    [created_at] datetime2(0)  NOT NULL,
  3036.    [updated_at] datetime2(0)  NOT NULL
  3037. )
  3038. GO
  3039. BEGIN TRY
  3040.     EXEC sp_addextendedproperty
  3041.         N'MS_SSMA_SOURCE', N'dbo.favorite',
  3042.         N'SCHEMA', N'dbo',
  3043.         N'TABLE', N'favorite'
  3044. END TRY
  3045. BEGIN CATCH
  3046.     IF (@@TRANCOUNT > 0) ROLLBACK
  3047.     PRINT ERROR_MESSAGE()
  3048. END CATCH
  3049. GO
  3050. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'file'  AND sc.name=N'dbo'  AND type in (N'U'))
  3051. BEGIN
  3052.  
  3053.   DECLARE @drop_statement nvarchar(500)
  3054.  
  3055.   DECLARE drop_cursor CURSOR FOR
  3056.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3057.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3058.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3059.       WHERE fk.referenced_object_id =
  3060.           (
  3061.              SELECT so.object_id
  3062.              FROM sys.objects so JOIN sys.schemas sc
  3063.              ON so.schema_id = sc.schema_id
  3064.              WHERE so.name = N'file'  AND sc.name=N'dbo'  AND type in (N'U')
  3065.            )
  3066.  
  3067.   OPEN drop_cursor
  3068.  
  3069.   FETCH NEXT FROM drop_cursor
  3070.   INTO @drop_statement
  3071.  
  3072.   WHILE @@FETCH_STATUS = 0
  3073.   BEGIN
  3074.      EXEC (@drop_statement)
  3075.  
  3076.      FETCH NEXT FROM drop_cursor
  3077.      INTO @drop_statement
  3078.   END
  3079.  
  3080.   CLOSE drop_cursor
  3081.   DEALLOCATE drop_cursor
  3082.  
  3083.   DROP TABLE [dbo].[file]
  3084. END
  3085. GO
  3086.  
  3087. SET ANSI_NULLS ON
  3088. GO
  3089. SET QUOTED_IDENTIFIER ON
  3090. GO
  3091. CREATE TABLE
  3092. [dbo].[file]
  3093. (
  3094.  
  3095.    /*
  3096.    *   SSMA informational messages:
  3097.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  3098.    */
  3099.  
  3100.    [id] int IDENTITY(1, 1)  NOT NULL,
  3101.  
  3102.    /*
  3103.    *   SSMA warning messages:
  3104.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3105.  
  3106.    *   SSMA informational messages:
  3107.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'File name'.
  3108.    */
  3109.  
  3110.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  3111.  
  3112.    /*
  3113.    *   SSMA warning messages:
  3114.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3115.  
  3116.    *   SSMA informational messages:
  3117.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Type of this file'.
  3118.    */
  3119.  
  3120.    [type] nvarchar(64) DEFAULT N''  NOT NULL,
  3121.  
  3122.    /*
  3123.    *   SSMA informational messages:
  3124.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'File size'.
  3125.    *   M2SS0052: string literal was converted to NUMERIC literal
  3126.    */
  3127.  
  3128.    [filesize] int DEFAULT 0  NOT NULL,
  3129.  
  3130.    /*
  3131.    *   SSMA warning messages:
  3132.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3133.  
  3134.    *   SSMA informational messages:
  3135.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Original filename'.
  3136.    */
  3137.  
  3138.    [original_filename] nvarchar(max)  NULL,
  3139.    [created_at] datetime2(0)  NOT NULL,
  3140.    [updated_at] datetime2(0)  NOT NULL
  3141. )
  3142. GO
  3143. BEGIN TRY
  3144.     EXEC sp_addextendedproperty
  3145.         N'MS_SSMA_SOURCE', N'dbo.file',
  3146.         N'SCHEMA', N'dbo',
  3147.         N'TABLE', N'file'
  3148. END TRY
  3149. BEGIN CATCH
  3150.     IF (@@TRANCOUNT > 0) ROLLBACK
  3151.     PRINT ERROR_MESSAGE()
  3152. END CATCH
  3153. GO
  3154. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'file_bin'  AND sc.name=N'dbo'  AND type in (N'U'))
  3155. BEGIN
  3156.  
  3157.   DECLARE @drop_statement nvarchar(500)
  3158.  
  3159.   DECLARE drop_cursor CURSOR FOR
  3160.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3161.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3162.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3163.       WHERE fk.referenced_object_id =
  3164.           (
  3165.              SELECT so.object_id
  3166.              FROM sys.objects so JOIN sys.schemas sc
  3167.              ON so.schema_id = sc.schema_id
  3168.              WHERE so.name = N'file_bin'  AND sc.name=N'dbo'  AND type in (N'U')
  3169.            )
  3170.  
  3171.   OPEN drop_cursor
  3172.  
  3173.   FETCH NEXT FROM drop_cursor
  3174.   INTO @drop_statement
  3175.  
  3176.   WHILE @@FETCH_STATUS = 0
  3177.   BEGIN
  3178.      EXEC (@drop_statement)
  3179.  
  3180.      FETCH NEXT FROM drop_cursor
  3181.      INTO @drop_statement
  3182.   END
  3183.  
  3184.   CLOSE drop_cursor
  3185.   DEALLOCATE drop_cursor
  3186.  
  3187.   DROP TABLE [dbo].[file_bin]
  3188. END
  3189. GO
  3190.  
  3191. SET ANSI_NULLS ON
  3192. GO
  3193. SET QUOTED_IDENTIFIER ON
  3194. GO
  3195. CREATE TABLE
  3196. [dbo].[file_bin]
  3197. (
  3198.  
  3199.    /*
  3200.    *   SSMA informational messages:
  3201.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'File id'.
  3202.    *   M2SS0052: string literal was converted to NUMERIC literal
  3203.    */
  3204.  
  3205.    [file_id] int DEFAULT 0  NOT NULL,
  3206.  
  3207.    /*
  3208.    *   SSMA informational messages:
  3209.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Content of file'.
  3210.    */
  3211.  
  3212.    [bin] varbinary(max)  NULL,
  3213.    [created_at] datetime2(0)  NOT NULL,
  3214.    [updated_at] datetime2(0)  NOT NULL
  3215. )
  3216. GO
  3217. BEGIN TRY
  3218.     EXEC sp_addextendedproperty
  3219.         N'MS_SSMA_SOURCE', N'dbo.file_bin',
  3220.         N'SCHEMA', N'dbo',
  3221.         N'TABLE', N'file_bin'
  3222. END TRY
  3223. BEGIN CATCH
  3224.     IF (@@TRANCOUNT > 0) ROLLBACK
  3225.     PRINT ERROR_MESSAGE()
  3226. END CATCH
  3227. GO
  3228. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'gadget'  AND sc.name=N'dbo'  AND type in (N'U'))
  3229. BEGIN
  3230.  
  3231.   DECLARE @drop_statement nvarchar(500)
  3232.  
  3233.   DECLARE drop_cursor CURSOR FOR
  3234.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3235.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3236.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3237.       WHERE fk.referenced_object_id =
  3238.           (
  3239.              SELECT so.object_id
  3240.              FROM sys.objects so JOIN sys.schemas sc
  3241.              ON so.schema_id = sc.schema_id
  3242.              WHERE so.name = N'gadget'  AND sc.name=N'dbo'  AND type in (N'U')
  3243.            )
  3244.  
  3245.   OPEN drop_cursor
  3246.  
  3247.   FETCH NEXT FROM drop_cursor
  3248.   INTO @drop_statement
  3249.  
  3250.   WHILE @@FETCH_STATUS = 0
  3251.   BEGIN
  3252.      EXEC (@drop_statement)
  3253.  
  3254.      FETCH NEXT FROM drop_cursor
  3255.      INTO @drop_statement
  3256.   END
  3257.  
  3258.   CLOSE drop_cursor
  3259.   DEALLOCATE drop_cursor
  3260.  
  3261.   DROP TABLE [dbo].[gadget]
  3262. END
  3263. GO
  3264.  
  3265. SET ANSI_NULLS ON
  3266. GO
  3267. SET QUOTED_IDENTIFIER ON
  3268. GO
  3269. CREATE TABLE
  3270. [dbo].[gadget]
  3271. (
  3272.  
  3273.    /*
  3274.    *   SSMA informational messages:
  3275.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  3276.    */
  3277.  
  3278.    [id] int IDENTITY(48, 1)  NOT NULL,
  3279.  
  3280.    /*
  3281.    *   SSMA warning messages:
  3282.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3283.  
  3284.    *   SSMA informational messages:
  3285.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Gadget type'.
  3286.    */
  3287.  
  3288.    [type] nvarchar(64) DEFAULT N''  NOT NULL,
  3289.  
  3290.    /*
  3291.    *   SSMA warning messages:
  3292.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3293.  
  3294.    *   SSMA informational messages:
  3295.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Gadget name'.
  3296.    */
  3297.  
  3298.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  3299.  
  3300.    /*
  3301.    *   SSMA informational messages:
  3302.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Order to sort'.
  3303.    */
  3304.  
  3305.    [sort_order] int DEFAULT NULL  NULL,
  3306.    [created_at] datetime2(0)  NOT NULL,
  3307.    [updated_at] datetime2(0)  NOT NULL
  3308. )
  3309. GO
  3310. BEGIN TRY
  3311.     EXEC sp_addextendedproperty
  3312.         N'MS_SSMA_SOURCE', N'dbo.gadget',
  3313.         N'SCHEMA', N'dbo',
  3314.         N'TABLE', N'gadget'
  3315. END TRY
  3316. BEGIN CATCH
  3317.     IF (@@TRANCOUNT > 0) ROLLBACK
  3318.     PRINT ERROR_MESSAGE()
  3319. END CATCH
  3320. GO
  3321. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'gadget_config'  AND sc.name=N'dbo'  AND type in (N'U'))
  3322. BEGIN
  3323.  
  3324.   DECLARE @drop_statement nvarchar(500)
  3325.  
  3326.   DECLARE drop_cursor CURSOR FOR
  3327.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3328.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3329.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3330.       WHERE fk.referenced_object_id =
  3331.           (
  3332.              SELECT so.object_id
  3333.              FROM sys.objects so JOIN sys.schemas sc
  3334.              ON so.schema_id = sc.schema_id
  3335.              WHERE so.name = N'gadget_config'  AND sc.name=N'dbo'  AND type in (N'U')
  3336.            )
  3337.  
  3338.   OPEN drop_cursor
  3339.  
  3340.   FETCH NEXT FROM drop_cursor
  3341.   INTO @drop_statement
  3342.  
  3343.   WHILE @@FETCH_STATUS = 0
  3344.   BEGIN
  3345.      EXEC (@drop_statement)
  3346.  
  3347.      FETCH NEXT FROM drop_cursor
  3348.      INTO @drop_statement
  3349.   END
  3350.  
  3351.   CLOSE drop_cursor
  3352.   DEALLOCATE drop_cursor
  3353.  
  3354.   DROP TABLE [dbo].[gadget_config]
  3355. END
  3356. GO
  3357.  
  3358. SET ANSI_NULLS ON
  3359. GO
  3360. SET QUOTED_IDENTIFIER ON
  3361. GO
  3362. CREATE TABLE
  3363. [dbo].[gadget_config]
  3364. (
  3365.  
  3366.    /*
  3367.    *   SSMA informational messages:
  3368.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  3369.    */
  3370.  
  3371.    [id] int IDENTITY(1, 1)  NOT NULL,
  3372.  
  3373.    /*
  3374.    *   SSMA warning messages:
  3375.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3376.  
  3377.    *   SSMA informational messages:
  3378.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration name'.
  3379.    */
  3380.  
  3381.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  3382.  
  3383.    /*
  3384.    *   SSMA informational messages:
  3385.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Gadget id'.
  3386.    */
  3387.  
  3388.    [gadget_id] int DEFAULT NULL  NULL,
  3389.  
  3390.    /*
  3391.    *   SSMA warning messages:
  3392.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3393.  
  3394.    *   SSMA informational messages:
  3395.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration value'.
  3396.    */
  3397.  
  3398.    [value] nvarchar(max)  NULL,
  3399.    [created_at] datetime2(0)  NOT NULL,
  3400.    [updated_at] datetime2(0)  NOT NULL
  3401. )
  3402. GO
  3403. BEGIN TRY
  3404.     EXEC sp_addextendedproperty
  3405.         N'MS_SSMA_SOURCE', N'dbo.gadget_config',
  3406.         N'SCHEMA', N'dbo',
  3407.         N'TABLE', N'gadget_config'
  3408. END TRY
  3409. BEGIN CATCH
  3410.     IF (@@TRANCOUNT > 0) ROLLBACK
  3411.     PRINT ERROR_MESSAGE()
  3412. END CATCH
  3413. GO
  3414. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member'  AND sc.name=N'dbo'  AND type in (N'U'))
  3415. BEGIN
  3416.  
  3417.   DECLARE @drop_statement nvarchar(500)
  3418.  
  3419.   DECLARE drop_cursor CURSOR FOR
  3420.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3421.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3422.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3423.       WHERE fk.referenced_object_id =
  3424.           (
  3425.              SELECT so.object_id
  3426.              FROM sys.objects so JOIN sys.schemas sc
  3427.              ON so.schema_id = sc.schema_id
  3428.              WHERE so.name = N'member'  AND sc.name=N'dbo'  AND type in (N'U')
  3429.            )
  3430.  
  3431.   OPEN drop_cursor
  3432.  
  3433.   FETCH NEXT FROM drop_cursor
  3434.   INTO @drop_statement
  3435.  
  3436.   WHILE @@FETCH_STATUS = 0
  3437.   BEGIN
  3438.      EXEC (@drop_statement)
  3439.  
  3440.      FETCH NEXT FROM drop_cursor
  3441.      INTO @drop_statement
  3442.   END
  3443.  
  3444.   CLOSE drop_cursor
  3445.   DEALLOCATE drop_cursor
  3446.  
  3447.   DROP TABLE [dbo].[member]
  3448. END
  3449. GO
  3450.  
  3451. SET ANSI_NULLS ON
  3452. GO
  3453. SET QUOTED_IDENTIFIER ON
  3454. GO
  3455. CREATE TABLE
  3456. [dbo].[member]
  3457. (
  3458.  
  3459.    /*
  3460.    *   SSMA informational messages:
  3461.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  3462.    */
  3463.  
  3464.    [id] int IDENTITY(2, 1)  NOT NULL,
  3465.  
  3466.    /*
  3467.    *   SSMA warning messages:
  3468.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3469.  
  3470.    *   SSMA informational messages:
  3471.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Nickname'.
  3472.    */
  3473.  
  3474.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  3475.  
  3476.    /*
  3477.    *   SSMA informational messages:
  3478.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id of the person who invited this member'.
  3479.    */
  3480.  
  3481.    [invite_member_id] int DEFAULT NULL  NULL,
  3482.  
  3483.    /*
  3484.    *   SSMA informational messages:
  3485.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Rejected member'.
  3486.    *   M2SS0052: string literal was converted to NUMERIC literal
  3487.    */
  3488.  
  3489.    [is_login_rejected] smallint DEFAULT 0  NOT NULL,
  3490.    [created_at] datetime2(0)  NOT NULL,
  3491.    [updated_at] datetime2(0)  NOT NULL,
  3492.  
  3493.    /*
  3494.    *   SSMA informational messages:
  3495.    *   M2SS0052: string literal was converted to NUMERIC literal
  3496.    */
  3497.  
  3498.    [is_active] smallint DEFAULT 0  NOT NULL
  3499. )
  3500. GO
  3501. BEGIN TRY
  3502.     EXEC sp_addextendedproperty
  3503.         N'MS_SSMA_SOURCE', N'dbo.member',
  3504.         N'SCHEMA', N'dbo',
  3505.         N'TABLE', N'member'
  3506. END TRY
  3507. BEGIN CATCH
  3508.     IF (@@TRANCOUNT > 0) ROLLBACK
  3509.     PRINT ERROR_MESSAGE()
  3510. END CATCH
  3511. GO
  3512. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_application'  AND sc.name=N'dbo'  AND type in (N'U'))
  3513. BEGIN
  3514.  
  3515.   DECLARE @drop_statement nvarchar(500)
  3516.  
  3517.   DECLARE drop_cursor CURSOR FOR
  3518.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3519.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3520.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3521.       WHERE fk.referenced_object_id =
  3522.           (
  3523.              SELECT so.object_id
  3524.              FROM sys.objects so JOIN sys.schemas sc
  3525.              ON so.schema_id = sc.schema_id
  3526.              WHERE so.name = N'member_application'  AND sc.name=N'dbo'  AND type in (N'U')
  3527.            )
  3528.  
  3529.   OPEN drop_cursor
  3530.  
  3531.   FETCH NEXT FROM drop_cursor
  3532.   INTO @drop_statement
  3533.  
  3534.   WHILE @@FETCH_STATUS = 0
  3535.   BEGIN
  3536.      EXEC (@drop_statement)
  3537.  
  3538.      FETCH NEXT FROM drop_cursor
  3539.      INTO @drop_statement
  3540.   END
  3541.  
  3542.   CLOSE drop_cursor
  3543.   DEALLOCATE drop_cursor
  3544.  
  3545.   DROP TABLE [dbo].[member_application]
  3546. END
  3547. GO
  3548.  
  3549. SET ANSI_NULLS ON
  3550. GO
  3551. SET QUOTED_IDENTIFIER ON
  3552. GO
  3553. CREATE TABLE
  3554. [dbo].[member_application]
  3555. (
  3556.    [id] bigint IDENTITY(1, 1)  NOT NULL,
  3557.    [member_id] int  NOT NULL,
  3558.    [application_id] bigint  NOT NULL,
  3559.    [public_flag] nvarchar(255) DEFAULT N'public'  NOT NULL,
  3560.    [sort_order] bigint DEFAULT NULL  NULL
  3561. )
  3562. GO
  3563. BEGIN TRY
  3564.     EXEC sp_addextendedproperty
  3565.         N'MS_SSMA_SOURCE', N'dbo.member_application',
  3566.         N'SCHEMA', N'dbo',
  3567.         N'TABLE', N'member_application'
  3568. END TRY
  3569. BEGIN CATCH
  3570.     IF (@@TRANCOUNT > 0) ROLLBACK
  3571.     PRINT ERROR_MESSAGE()
  3572. END CATCH
  3573. GO
  3574. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_application_setting'  AND sc.name=N'dbo'  AND type in (N'U'))
  3575. BEGIN
  3576.  
  3577.   DECLARE @drop_statement nvarchar(500)
  3578.  
  3579.   DECLARE drop_cursor CURSOR FOR
  3580.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3581.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3582.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3583.       WHERE fk.referenced_object_id =
  3584.           (
  3585.              SELECT so.object_id
  3586.              FROM sys.objects so JOIN sys.schemas sc
  3587.              ON so.schema_id = sc.schema_id
  3588.              WHERE so.name = N'member_application_setting'  AND sc.name=N'dbo'  AND type in (N'U')
  3589.            )
  3590.  
  3591.   OPEN drop_cursor
  3592.  
  3593.   FETCH NEXT FROM drop_cursor
  3594.   INTO @drop_statement
  3595.  
  3596.   WHILE @@FETCH_STATUS = 0
  3597.   BEGIN
  3598.      EXEC (@drop_statement)
  3599.  
  3600.      FETCH NEXT FROM drop_cursor
  3601.      INTO @drop_statement
  3602.   END
  3603.  
  3604.   CLOSE drop_cursor
  3605.   DEALLOCATE drop_cursor
  3606.  
  3607.   DROP TABLE [dbo].[member_application_setting]
  3608. END
  3609. GO
  3610.  
  3611. SET ANSI_NULLS ON
  3612. GO
  3613. SET QUOTED_IDENTIFIER ON
  3614. GO
  3615. CREATE TABLE
  3616. [dbo].[member_application_setting]
  3617. (
  3618.    [id] bigint IDENTITY(1, 1)  NOT NULL,
  3619.    [member_application_id] bigint  NOT NULL,
  3620.    [type] nvarchar(255) DEFAULT N'application'  NOT NULL,
  3621.    [name] nvarchar(255)  NOT NULL,
  3622.    [hash] nvarchar(32)  NOT NULL,
  3623.    [value] nvarchar(max)  NULL
  3624. )
  3625. GO
  3626. BEGIN TRY
  3627.     EXEC sp_addextendedproperty
  3628.         N'MS_SSMA_SOURCE', N'dbo.member_application_setting',
  3629.         N'SCHEMA', N'dbo',
  3630.         N'TABLE', N'member_application_setting'
  3631. END TRY
  3632. BEGIN CATCH
  3633.     IF (@@TRANCOUNT > 0) ROLLBACK
  3634.     PRINT ERROR_MESSAGE()
  3635. END CATCH
  3636. GO
  3637. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_config'  AND sc.name=N'dbo'  AND type in (N'U'))
  3638. BEGIN
  3639.  
  3640.   DECLARE @drop_statement nvarchar(500)
  3641.  
  3642.   DECLARE drop_cursor CURSOR FOR
  3643.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3644.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3645.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3646.       WHERE fk.referenced_object_id =
  3647.           (
  3648.              SELECT so.object_id
  3649.              FROM sys.objects so JOIN sys.schemas sc
  3650.              ON so.schema_id = sc.schema_id
  3651.              WHERE so.name = N'member_config'  AND sc.name=N'dbo'  AND type in (N'U')
  3652.            )
  3653.  
  3654.   OPEN drop_cursor
  3655.  
  3656.   FETCH NEXT FROM drop_cursor
  3657.   INTO @drop_statement
  3658.  
  3659.   WHILE @@FETCH_STATUS = 0
  3660.   BEGIN
  3661.      EXEC (@drop_statement)
  3662.  
  3663.      FETCH NEXT FROM drop_cursor
  3664.      INTO @drop_statement
  3665.   END
  3666.  
  3667.   CLOSE drop_cursor
  3668.   DEALLOCATE drop_cursor
  3669.  
  3670.   DROP TABLE [dbo].[member_config]
  3671. END
  3672. GO
  3673.  
  3674. SET ANSI_NULLS ON
  3675. GO
  3676. SET QUOTED_IDENTIFIER ON
  3677. GO
  3678. CREATE TABLE
  3679. [dbo].[member_config]
  3680. (
  3681.  
  3682.    /*
  3683.    *   SSMA informational messages:
  3684.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  3685.    */
  3686.  
  3687.    [id] int IDENTITY(5, 1)  NOT NULL,
  3688.  
  3689.    /*
  3690.    *   SSMA informational messages:
  3691.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  3692.    */
  3693.  
  3694.    [member_id] int  NOT NULL,
  3695.  
  3696.    /*
  3697.    *   SSMA warning messages:
  3698.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3699.  
  3700.    *   SSMA informational messages:
  3701.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration name'.
  3702.    */
  3703.  
  3704.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  3705.  
  3706.    /*
  3707.    *   SSMA warning messages:
  3708.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3709.  
  3710.    *   SSMA informational messages:
  3711.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration value'.
  3712.    */
  3713.  
  3714.    [value] nvarchar(max)  NOT NULL,
  3715.  
  3716.    /*
  3717.    *   SSMA informational messages:
  3718.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration datetime value'.
  3719.    */
  3720.  
  3721.    [value_datetime] datetime2(0) DEFAULT NULL  NULL,
  3722.  
  3723.    /*
  3724.    *   SSMA warning messages:
  3725.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3726.  
  3727.    *   SSMA informational messages:
  3728.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Hash value for searching name & value'.
  3729.    */
  3730.  
  3731.    [name_value_hash] nvarchar(32)  NOT NULL,
  3732.    [created_at] datetime2(0)  NOT NULL,
  3733.    [updated_at] datetime2(0)  NOT NULL
  3734. )
  3735. GO
  3736. BEGIN TRY
  3737.     EXEC sp_addextendedproperty
  3738.         N'MS_SSMA_SOURCE', N'dbo.member_config',
  3739.         N'SCHEMA', N'dbo',
  3740.         N'TABLE', N'member_config'
  3741. END TRY
  3742. BEGIN CATCH
  3743.     IF (@@TRANCOUNT > 0) ROLLBACK
  3744.     PRINT ERROR_MESSAGE()
  3745. END CATCH
  3746. GO
  3747. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_image'  AND sc.name=N'dbo'  AND type in (N'U'))
  3748. BEGIN
  3749.  
  3750.   DECLARE @drop_statement nvarchar(500)
  3751.  
  3752.   DECLARE drop_cursor CURSOR FOR
  3753.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3754.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3755.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3756.       WHERE fk.referenced_object_id =
  3757.           (
  3758.              SELECT so.object_id
  3759.              FROM sys.objects so JOIN sys.schemas sc
  3760.              ON so.schema_id = sc.schema_id
  3761.              WHERE so.name = N'member_image'  AND sc.name=N'dbo'  AND type in (N'U')
  3762.            )
  3763.  
  3764.   OPEN drop_cursor
  3765.  
  3766.   FETCH NEXT FROM drop_cursor
  3767.   INTO @drop_statement
  3768.  
  3769.   WHILE @@FETCH_STATUS = 0
  3770.   BEGIN
  3771.      EXEC (@drop_statement)
  3772.  
  3773.      FETCH NEXT FROM drop_cursor
  3774.      INTO @drop_statement
  3775.   END
  3776.  
  3777.   CLOSE drop_cursor
  3778.   DEALLOCATE drop_cursor
  3779.  
  3780.   DROP TABLE [dbo].[member_image]
  3781. END
  3782. GO
  3783.  
  3784. SET ANSI_NULLS ON
  3785. GO
  3786. SET QUOTED_IDENTIFIER ON
  3787. GO
  3788. CREATE TABLE
  3789. [dbo].[member_image]
  3790. (
  3791.  
  3792.    /*
  3793.    *   SSMA informational messages:
  3794.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  3795.    */
  3796.  
  3797.    [id] int IDENTITY(1, 1)  NOT NULL,
  3798.  
  3799.    /*
  3800.    *   SSMA informational messages:
  3801.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  3802.    */
  3803.  
  3804.    [member_id] int  NOT NULL,
  3805.  
  3806.    /*
  3807.    *   SSMA informational messages:
  3808.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Image file id in the ''file'' table'.
  3809.    */
  3810.  
  3811.    [file_id] int  NOT NULL,
  3812.  
  3813.    /*
  3814.    *   SSMA informational messages:
  3815.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'This is primary'.
  3816.    */
  3817.  
  3818.    [is_primary] smallint DEFAULT NULL  NULL,
  3819.    [created_at] datetime2(0)  NOT NULL,
  3820.    [updated_at] datetime2(0)  NOT NULL
  3821. )
  3822. GO
  3823. BEGIN TRY
  3824.     EXEC sp_addextendedproperty
  3825.         N'MS_SSMA_SOURCE', N'dbo.member_image',
  3826.         N'SCHEMA', N'dbo',
  3827.         N'TABLE', N'member_image'
  3828. END TRY
  3829. BEGIN CATCH
  3830.     IF (@@TRANCOUNT > 0) ROLLBACK
  3831.     PRINT ERROR_MESSAGE()
  3832. END CATCH
  3833. GO
  3834. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_profile'  AND sc.name=N'dbo'  AND type in (N'U'))
  3835. BEGIN
  3836.  
  3837.   DECLARE @drop_statement nvarchar(500)
  3838.  
  3839.   DECLARE drop_cursor CURSOR FOR
  3840.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3841.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3842.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3843.       WHERE fk.referenced_object_id =
  3844.           (
  3845.              SELECT so.object_id
  3846.              FROM sys.objects so JOIN sys.schemas sc
  3847.              ON so.schema_id = sc.schema_id
  3848.              WHERE so.name = N'member_profile'  AND sc.name=N'dbo'  AND type in (N'U')
  3849.            )
  3850.  
  3851.   OPEN drop_cursor
  3852.  
  3853.   FETCH NEXT FROM drop_cursor
  3854.   INTO @drop_statement
  3855.  
  3856.   WHILE @@FETCH_STATUS = 0
  3857.   BEGIN
  3858.      EXEC (@drop_statement)
  3859.  
  3860.      FETCH NEXT FROM drop_cursor
  3861.      INTO @drop_statement
  3862.   END
  3863.  
  3864.   CLOSE drop_cursor
  3865.   DEALLOCATE drop_cursor
  3866.  
  3867.   DROP TABLE [dbo].[member_profile]
  3868. END
  3869. GO
  3870.  
  3871. SET ANSI_NULLS ON
  3872. GO
  3873. SET QUOTED_IDENTIFIER ON
  3874. GO
  3875. CREATE TABLE
  3876. [dbo].[member_profile]
  3877. (
  3878.  
  3879.    /*
  3880.    *   SSMA informational messages:
  3881.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  3882.    */
  3883.  
  3884.    [id] int IDENTITY(5, 1)  NOT NULL,
  3885.  
  3886.    /*
  3887.    *   SSMA informational messages:
  3888.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  3889.    */
  3890.  
  3891.    [member_id] int  NOT NULL,
  3892.  
  3893.    /*
  3894.    *   SSMA informational messages:
  3895.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Profile id'.
  3896.    */
  3897.  
  3898.    [profile_id] int  NOT NULL,
  3899.  
  3900.    /*
  3901.    *   SSMA informational messages:
  3902.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Profile option id'.
  3903.    */
  3904.  
  3905.    [profile_option_id] int DEFAULT NULL  NULL,
  3906.  
  3907.    /*
  3908.    *   SSMA warning messages:
  3909.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  3910.  
  3911.    *   SSMA informational messages:
  3912.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Text content for this profile item'.
  3913.    */
  3914.  
  3915.    [value] nvarchar(max)  NOT NULL,
  3916.  
  3917.    /*
  3918.    *   SSMA informational messages:
  3919.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Profile datetime value'.
  3920.    */
  3921.  
  3922.    [value_datetime] datetime2(0) DEFAULT NULL  NULL,
  3923.  
  3924.    /*
  3925.    *   SSMA informational messages:
  3926.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Public flag'.
  3927.    */
  3928.  
  3929.    [public_flag] smallint DEFAULT NULL  NULL,
  3930.    [tree_key] bigint DEFAULT NULL  NULL,
  3931.    [lft] int DEFAULT NULL  NULL,
  3932.    [rgt] int DEFAULT NULL  NULL,
  3933.    [level] smallint DEFAULT NULL  NULL,
  3934.    [created_at] datetime2(0)  NOT NULL,
  3935.    [updated_at] datetime2(0)  NOT NULL
  3936. )
  3937. GO
  3938. BEGIN TRY
  3939.     EXEC sp_addextendedproperty
  3940.         N'MS_SSMA_SOURCE', N'dbo.member_profile',
  3941.         N'SCHEMA', N'dbo',
  3942.         N'TABLE', N'member_profile'
  3943. END TRY
  3944. BEGIN CATCH
  3945.     IF (@@TRANCOUNT > 0) ROLLBACK
  3946.     PRINT ERROR_MESSAGE()
  3947. END CATCH
  3948. GO
  3949. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_relationship'  AND sc.name=N'dbo'  AND type in (N'U'))
  3950. BEGIN
  3951.  
  3952.   DECLARE @drop_statement nvarchar(500)
  3953.  
  3954.   DECLARE drop_cursor CURSOR FOR
  3955.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  3956.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  3957.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  3958.       WHERE fk.referenced_object_id =
  3959.           (
  3960.              SELECT so.object_id
  3961.              FROM sys.objects so JOIN sys.schemas sc
  3962.              ON so.schema_id = sc.schema_id
  3963.              WHERE so.name = N'member_relationship'  AND sc.name=N'dbo'  AND type in (N'U')
  3964.            )
  3965.  
  3966.   OPEN drop_cursor
  3967.  
  3968.   FETCH NEXT FROM drop_cursor
  3969.   INTO @drop_statement
  3970.  
  3971.   WHILE @@FETCH_STATUS = 0
  3972.   BEGIN
  3973.      EXEC (@drop_statement)
  3974.  
  3975.      FETCH NEXT FROM drop_cursor
  3976.      INTO @drop_statement
  3977.   END
  3978.  
  3979.   CLOSE drop_cursor
  3980.   DEALLOCATE drop_cursor
  3981.  
  3982.   DROP TABLE [dbo].[member_relationship]
  3983. END
  3984. GO
  3985.  
  3986. SET ANSI_NULLS ON
  3987. GO
  3988. SET QUOTED_IDENTIFIER ON
  3989. GO
  3990. CREATE TABLE
  3991. [dbo].[member_relationship]
  3992. (
  3993.  
  3994.    /*
  3995.    *   SSMA informational messages:
  3996.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  3997.    */
  3998.  
  3999.    [id] int IDENTITY(1, 1)  NOT NULL,
  4000.  
  4001.    /*
  4002.    *   SSMA informational messages:
  4003.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Target member id'.
  4004.    */
  4005.  
  4006.    [member_id_to] int  NOT NULL,
  4007.  
  4008.    /*
  4009.    *   SSMA informational messages:
  4010.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Subject member id'.
  4011.    */
  4012.  
  4013.    [member_id_from] int  NOT NULL,
  4014.  
  4015.    /*
  4016.    *   SSMA informational messages:
  4017.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'The members are friends'.
  4018.    */
  4019.  
  4020.    [is_friend] smallint DEFAULT NULL  NULL,
  4021.  
  4022.    /*
  4023.    *   SSMA informational messages:
  4024.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'The members are going to be friends'.
  4025.    */
  4026.  
  4027.    [is_friend_pre] smallint DEFAULT NULL  NULL,
  4028.  
  4029.    /*
  4030.    *   SSMA informational messages:
  4031.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'The subject member is blocked the target'.
  4032.    */
  4033.  
  4034.    [is_access_block] smallint DEFAULT NULL  NULL,
  4035.    [created_at] datetime2(0)  NOT NULL,
  4036.    [updated_at] datetime2(0)  NOT NULL
  4037. )
  4038. GO
  4039. BEGIN TRY
  4040.     EXEC sp_addextendedproperty
  4041.         N'MS_SSMA_SOURCE', N'dbo.member_relationship',
  4042.         N'SCHEMA', N'dbo',
  4043.         N'TABLE', N'member_relationship'
  4044. END TRY
  4045. BEGIN CATCH
  4046.     IF (@@TRANCOUNT > 0) ROLLBACK
  4047.     PRINT ERROR_MESSAGE()
  4048. END CATCH
  4049. GO
  4050. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message'  AND sc.name=N'dbo'  AND type in (N'U'))
  4051. BEGIN
  4052.  
  4053.   DECLARE @drop_statement nvarchar(500)
  4054.  
  4055.   DECLARE drop_cursor CURSOR FOR
  4056.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4057.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4058.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4059.       WHERE fk.referenced_object_id =
  4060.           (
  4061.              SELECT so.object_id
  4062.              FROM sys.objects so JOIN sys.schemas sc
  4063.              ON so.schema_id = sc.schema_id
  4064.              WHERE so.name = N'message'  AND sc.name=N'dbo'  AND type in (N'U')
  4065.            )
  4066.  
  4067.   OPEN drop_cursor
  4068.  
  4069.   FETCH NEXT FROM drop_cursor
  4070.   INTO @drop_statement
  4071.  
  4072.   WHILE @@FETCH_STATUS = 0
  4073.   BEGIN
  4074.      EXEC (@drop_statement)
  4075.  
  4076.      FETCH NEXT FROM drop_cursor
  4077.      INTO @drop_statement
  4078.   END
  4079.  
  4080.   CLOSE drop_cursor
  4081.   DEALLOCATE drop_cursor
  4082.  
  4083.   DROP TABLE [dbo].[message]
  4084. END
  4085. GO
  4086.  
  4087. SET ANSI_NULLS ON
  4088. GO
  4089. SET QUOTED_IDENTIFIER ON
  4090. GO
  4091. CREATE TABLE
  4092. [dbo].[message]
  4093. (
  4094.    [id] int IDENTITY(1, 1)  NOT NULL,
  4095.    [member_id] int DEFAULT NULL  NULL,
  4096.    [subject] nvarchar(max)  NULL,
  4097.    [body] nvarchar(max)  NULL,
  4098.  
  4099.    /*
  4100.    *   SSMA informational messages:
  4101.    *   M2SS0052: string literal was converted to NUMERIC literal
  4102.    */
  4103.  
  4104.    [is_deleted] smallint DEFAULT 0  NOT NULL,
  4105.  
  4106.    /*
  4107.    *   SSMA informational messages:
  4108.    *   M2SS0052: string literal was converted to NUMERIC literal
  4109.    */
  4110.  
  4111.    [is_send] smallint DEFAULT 0  NOT NULL,
  4112.  
  4113.    /*
  4114.    *   SSMA informational messages:
  4115.    *   M2SS0052: string literal was converted to NUMERIC literal
  4116.    */
  4117.  
  4118.    [thread_message_id] int DEFAULT 0  NULL,
  4119.  
  4120.    /*
  4121.    *   SSMA informational messages:
  4122.    *   M2SS0052: string literal was converted to NUMERIC literal
  4123.    */
  4124.  
  4125.    [return_message_id] int DEFAULT 0  NULL,
  4126.    [message_type_id] int DEFAULT NULL  NULL,
  4127.  
  4128.    /*
  4129.    *   SSMA informational messages:
  4130.    *   M2SS0052: string literal was converted to NUMERIC literal
  4131.    */
  4132.  
  4133.    [foreign_id] int DEFAULT 0  NULL,
  4134.    [created_at] datetime2(0)  NOT NULL,
  4135.    [updated_at] datetime2(0)  NOT NULL
  4136. )
  4137. GO
  4138. BEGIN TRY
  4139.     EXEC sp_addextendedproperty
  4140.         N'MS_SSMA_SOURCE', N'dbo.message',
  4141.         N'SCHEMA', N'dbo',
  4142.         N'TABLE', N'message'
  4143. END TRY
  4144. BEGIN CATCH
  4145.     IF (@@TRANCOUNT > 0) ROLLBACK
  4146.     PRINT ERROR_MESSAGE()
  4147. END CATCH
  4148. GO
  4149. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_file'  AND sc.name=N'dbo'  AND type in (N'U'))
  4150. BEGIN
  4151.  
  4152.   DECLARE @drop_statement nvarchar(500)
  4153.  
  4154.   DECLARE drop_cursor CURSOR FOR
  4155.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4156.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4157.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4158.       WHERE fk.referenced_object_id =
  4159.           (
  4160.              SELECT so.object_id
  4161.              FROM sys.objects so JOIN sys.schemas sc
  4162.              ON so.schema_id = sc.schema_id
  4163.              WHERE so.name = N'message_file'  AND sc.name=N'dbo'  AND type in (N'U')
  4164.            )
  4165.  
  4166.   OPEN drop_cursor
  4167.  
  4168.   FETCH NEXT FROM drop_cursor
  4169.   INTO @drop_statement
  4170.  
  4171.   WHILE @@FETCH_STATUS = 0
  4172.   BEGIN
  4173.      EXEC (@drop_statement)
  4174.  
  4175.      FETCH NEXT FROM drop_cursor
  4176.      INTO @drop_statement
  4177.   END
  4178.  
  4179.   CLOSE drop_cursor
  4180.   DEALLOCATE drop_cursor
  4181.  
  4182.   DROP TABLE [dbo].[message_file]
  4183. END
  4184. GO
  4185.  
  4186. SET ANSI_NULLS ON
  4187. GO
  4188. SET QUOTED_IDENTIFIER ON
  4189. GO
  4190. CREATE TABLE
  4191. [dbo].[message_file]
  4192. (
  4193.    [id] int IDENTITY(1, 1)  NOT NULL,
  4194.    [message_id] int  NOT NULL,
  4195.    [file_id] int  NOT NULL,
  4196.    [created_at] datetime2(0)  NOT NULL,
  4197.    [updated_at] datetime2(0)  NOT NULL
  4198. )
  4199. GO
  4200. BEGIN TRY
  4201.     EXEC sp_addextendedproperty
  4202.         N'MS_SSMA_SOURCE', N'dbo.message_file',
  4203.         N'SCHEMA', N'dbo',
  4204.         N'TABLE', N'message_file'
  4205. END TRY
  4206. BEGIN CATCH
  4207.     IF (@@TRANCOUNT > 0) ROLLBACK
  4208.     PRINT ERROR_MESSAGE()
  4209. END CATCH
  4210. GO
  4211. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_send_list'  AND sc.name=N'dbo'  AND type in (N'U'))
  4212. BEGIN
  4213.  
  4214.   DECLARE @drop_statement nvarchar(500)
  4215.  
  4216.   DECLARE drop_cursor CURSOR FOR
  4217.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4218.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4219.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4220.       WHERE fk.referenced_object_id =
  4221.           (
  4222.              SELECT so.object_id
  4223.              FROM sys.objects so JOIN sys.schemas sc
  4224.              ON so.schema_id = sc.schema_id
  4225.              WHERE so.name = N'message_send_list'  AND sc.name=N'dbo'  AND type in (N'U')
  4226.            )
  4227.  
  4228.   OPEN drop_cursor
  4229.  
  4230.   FETCH NEXT FROM drop_cursor
  4231.   INTO @drop_statement
  4232.  
  4233.   WHILE @@FETCH_STATUS = 0
  4234.   BEGIN
  4235.      EXEC (@drop_statement)
  4236.  
  4237.      FETCH NEXT FROM drop_cursor
  4238.      INTO @drop_statement
  4239.   END
  4240.  
  4241.   CLOSE drop_cursor
  4242.   DEALLOCATE drop_cursor
  4243.  
  4244.   DROP TABLE [dbo].[message_send_list]
  4245. END
  4246. GO
  4247.  
  4248. SET ANSI_NULLS ON
  4249. GO
  4250. SET QUOTED_IDENTIFIER ON
  4251. GO
  4252. CREATE TABLE
  4253. [dbo].[message_send_list]
  4254. (
  4255.    [id] int IDENTITY(1, 1)  NOT NULL,
  4256.    [member_id] int DEFAULT NULL  NULL,
  4257.    [message_id] int DEFAULT NULL  NULL,
  4258.  
  4259.    /*
  4260.    *   SSMA informational messages:
  4261.    *   M2SS0052: string literal was converted to NUMERIC literal
  4262.    */
  4263.  
  4264.    [is_read] smallint DEFAULT 0  NOT NULL,
  4265.  
  4266.    /*
  4267.    *   SSMA informational messages:
  4268.    *   M2SS0052: string literal was converted to NUMERIC literal
  4269.    */
  4270.  
  4271.    [is_deleted] smallint DEFAULT 0  NOT NULL,
  4272.    [created_at] datetime2(0)  NOT NULL,
  4273.    [updated_at] datetime2(0)  NOT NULL
  4274. )
  4275. GO
  4276. BEGIN TRY
  4277.     EXEC sp_addextendedproperty
  4278.         N'MS_SSMA_SOURCE', N'dbo.message_send_list',
  4279.         N'SCHEMA', N'dbo',
  4280.         N'TABLE', N'message_send_list'
  4281. END TRY
  4282. BEGIN CATCH
  4283.     IF (@@TRANCOUNT > 0) ROLLBACK
  4284.     PRINT ERROR_MESSAGE()
  4285. END CATCH
  4286. GO
  4287. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_type'  AND sc.name=N'dbo'  AND type in (N'U'))
  4288. BEGIN
  4289.  
  4290.   DECLARE @drop_statement nvarchar(500)
  4291.  
  4292.   DECLARE drop_cursor CURSOR FOR
  4293.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4294.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4295.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4296.       WHERE fk.referenced_object_id =
  4297.           (
  4298.              SELECT so.object_id
  4299.              FROM sys.objects so JOIN sys.schemas sc
  4300.              ON so.schema_id = sc.schema_id
  4301.              WHERE so.name = N'message_type'  AND sc.name=N'dbo'  AND type in (N'U')
  4302.            )
  4303.  
  4304.   OPEN drop_cursor
  4305.  
  4306.   FETCH NEXT FROM drop_cursor
  4307.   INTO @drop_statement
  4308.  
  4309.   WHILE @@FETCH_STATUS = 0
  4310.   BEGIN
  4311.      EXEC (@drop_statement)
  4312.  
  4313.      FETCH NEXT FROM drop_cursor
  4314.      INTO @drop_statement
  4315.   END
  4316.  
  4317.   CLOSE drop_cursor
  4318.   DEALLOCATE drop_cursor
  4319.  
  4320.   DROP TABLE [dbo].[message_type]
  4321. END
  4322. GO
  4323.  
  4324. SET ANSI_NULLS ON
  4325. GO
  4326. SET QUOTED_IDENTIFIER ON
  4327. GO
  4328. CREATE TABLE
  4329. [dbo].[message_type]
  4330. (
  4331.    [id] int IDENTITY(6, 1)  NOT NULL,
  4332.    [type_name] nvarchar(max)  NOT NULL,
  4333.    [foreign_table] nvarchar(max)  NULL,
  4334.  
  4335.    /*
  4336.    *   SSMA informational messages:
  4337.    *   M2SS0052: string literal was converted to NUMERIC literal
  4338.    */
  4339.  
  4340.    [is_deleted] smallint DEFAULT 0  NOT NULL,
  4341.    [created_at] datetime2(0)  NOT NULL,
  4342.    [updated_at] datetime2(0)  NOT NULL
  4343. )
  4344. GO
  4345. BEGIN TRY
  4346.     EXEC sp_addextendedproperty
  4347.         N'MS_SSMA_SOURCE', N'dbo.message_type',
  4348.         N'SCHEMA', N'dbo',
  4349.         N'TABLE', N'message_type'
  4350. END TRY
  4351. BEGIN CATCH
  4352.     IF (@@TRANCOUNT > 0) ROLLBACK
  4353.     PRINT ERROR_MESSAGE()
  4354. END CATCH
  4355. GO
  4356. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_type_translation'  AND sc.name=N'dbo'  AND type in (N'U'))
  4357. BEGIN
  4358.  
  4359.   DECLARE @drop_statement nvarchar(500)
  4360.  
  4361.   DECLARE drop_cursor CURSOR FOR
  4362.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4363.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4364.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4365.       WHERE fk.referenced_object_id =
  4366.           (
  4367.              SELECT so.object_id
  4368.              FROM sys.objects so JOIN sys.schemas sc
  4369.              ON so.schema_id = sc.schema_id
  4370.              WHERE so.name = N'message_type_translation'  AND sc.name=N'dbo'  AND type in (N'U')
  4371.            )
  4372.  
  4373.   OPEN drop_cursor
  4374.  
  4375.   FETCH NEXT FROM drop_cursor
  4376.   INTO @drop_statement
  4377.  
  4378.   WHILE @@FETCH_STATUS = 0
  4379.   BEGIN
  4380.      EXEC (@drop_statement)
  4381.  
  4382.      FETCH NEXT FROM drop_cursor
  4383.      INTO @drop_statement
  4384.   END
  4385.  
  4386.   CLOSE drop_cursor
  4387.   DEALLOCATE drop_cursor
  4388.  
  4389.   DROP TABLE [dbo].[message_type_translation]
  4390. END
  4391. GO
  4392.  
  4393. SET ANSI_NULLS ON
  4394. GO
  4395. SET QUOTED_IDENTIFIER ON
  4396. GO
  4397. CREATE TABLE
  4398. [dbo].[message_type_translation]
  4399. (
  4400.  
  4401.    /*
  4402.    *   SSMA informational messages:
  4403.    *   M2SS0052: string literal was converted to NUMERIC literal
  4404.    */
  4405.  
  4406.    [id] int DEFAULT 0  NOT NULL,
  4407.    [body] nvarchar(max)  NULL,
  4408.    [subject] nvarchar(max)  NULL,
  4409.    [caption] nvarchar(max)  NOT NULL,
  4410.    [info] nvarchar(max)  NULL,
  4411.    [lang] nchar(5) DEFAULT N''  NOT NULL
  4412. )
  4413. GO
  4414. BEGIN TRY
  4415.     EXEC sp_addextendedproperty
  4416.         N'MS_SSMA_SOURCE', N'dbo.message_type_translation',
  4417.         N'SCHEMA', N'dbo',
  4418.         N'TABLE', N'message_type_translation'
  4419. END TRY
  4420. BEGIN CATCH
  4421.     IF (@@TRANCOUNT > 0) ROLLBACK
  4422.     PRINT ERROR_MESSAGE()
  4423. END CATCH
  4424. GO
  4425. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'navigation'  AND sc.name=N'dbo'  AND type in (N'U'))
  4426. BEGIN
  4427.  
  4428.   DECLARE @drop_statement nvarchar(500)
  4429.  
  4430.   DECLARE drop_cursor CURSOR FOR
  4431.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4432.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4433.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4434.       WHERE fk.referenced_object_id =
  4435.           (
  4436.              SELECT so.object_id
  4437.              FROM sys.objects so JOIN sys.schemas sc
  4438.              ON so.schema_id = sc.schema_id
  4439.              WHERE so.name = N'navigation'  AND sc.name=N'dbo'  AND type in (N'U')
  4440.            )
  4441.  
  4442.   OPEN drop_cursor
  4443.  
  4444.   FETCH NEXT FROM drop_cursor
  4445.   INTO @drop_statement
  4446.  
  4447.   WHILE @@FETCH_STATUS = 0
  4448.   BEGIN
  4449.      EXEC (@drop_statement)
  4450.  
  4451.      FETCH NEXT FROM drop_cursor
  4452.      INTO @drop_statement
  4453.   END
  4454.  
  4455.   CLOSE drop_cursor
  4456.   DEALLOCATE drop_cursor
  4457.  
  4458.   DROP TABLE [dbo].[navigation]
  4459. END
  4460. GO
  4461.  
  4462. SET ANSI_NULLS ON
  4463. GO
  4464. SET QUOTED_IDENTIFIER ON
  4465. GO
  4466. CREATE TABLE
  4467. [dbo].[navigation]
  4468. (
  4469.  
  4470.    /*
  4471.    *   SSMA informational messages:
  4472.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  4473.    */
  4474.  
  4475.    [id] int IDENTITY(55, 1)  NOT NULL,
  4476.  
  4477.    /*
  4478.    *   SSMA warning messages:
  4479.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4480.  
  4481.    *   SSMA informational messages:
  4482.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Navigation type'.
  4483.    */
  4484.  
  4485.    [type] nvarchar(64) DEFAULT N''  NOT NULL,
  4486.  
  4487.    /*
  4488.    *   SSMA warning messages:
  4489.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4490.  
  4491.    *   SSMA informational messages:
  4492.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Linked page''s URI'.
  4493.    */
  4494.  
  4495.    [uri] nvarchar(max)  NOT NULL,
  4496.  
  4497.    /*
  4498.    *   SSMA informational messages:
  4499.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Order to sort'.
  4500.    */
  4501.  
  4502.    [sort_order] int DEFAULT NULL  NULL,
  4503.    [created_at] datetime2(0)  NOT NULL,
  4504.    [updated_at] datetime2(0)  NOT NULL
  4505. )
  4506. GO
  4507. BEGIN TRY
  4508.     EXEC sp_addextendedproperty
  4509.         N'MS_SSMA_SOURCE', N'dbo.navigation',
  4510.         N'SCHEMA', N'dbo',
  4511.         N'TABLE', N'navigation'
  4512. END TRY
  4513. BEGIN CATCH
  4514.     IF (@@TRANCOUNT > 0) ROLLBACK
  4515.     PRINT ERROR_MESSAGE()
  4516. END CATCH
  4517. GO
  4518. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'navigation_translation'  AND sc.name=N'dbo'  AND type in (N'U'))
  4519. BEGIN
  4520.  
  4521.   DECLARE @drop_statement nvarchar(500)
  4522.  
  4523.   DECLARE drop_cursor CURSOR FOR
  4524.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4525.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4526.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4527.       WHERE fk.referenced_object_id =
  4528.           (
  4529.              SELECT so.object_id
  4530.              FROM sys.objects so JOIN sys.schemas sc
  4531.              ON so.schema_id = sc.schema_id
  4532.              WHERE so.name = N'navigation_translation'  AND sc.name=N'dbo'  AND type in (N'U')
  4533.            )
  4534.  
  4535.   OPEN drop_cursor
  4536.  
  4537.   FETCH NEXT FROM drop_cursor
  4538.   INTO @drop_statement
  4539.  
  4540.   WHILE @@FETCH_STATUS = 0
  4541.   BEGIN
  4542.      EXEC (@drop_statement)
  4543.  
  4544.      FETCH NEXT FROM drop_cursor
  4545.      INTO @drop_statement
  4546.   END
  4547.  
  4548.   CLOSE drop_cursor
  4549.   DEALLOCATE drop_cursor
  4550.  
  4551.   DROP TABLE [dbo].[navigation_translation]
  4552. END
  4553. GO
  4554.  
  4555. SET ANSI_NULLS ON
  4556. GO
  4557. SET QUOTED_IDENTIFIER ON
  4558. GO
  4559. CREATE TABLE
  4560. [dbo].[navigation_translation]
  4561. (
  4562.  
  4563.    /*
  4564.    *   SSMA informational messages:
  4565.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  4566.    *   M2SS0052: string literal was converted to NUMERIC literal
  4567.    */
  4568.  
  4569.    [id] int DEFAULT 0  NOT NULL,
  4570.  
  4571.    /*
  4572.    *   SSMA warning messages:
  4573.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4574.  
  4575.    *   SSMA informational messages:
  4576.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Description'.
  4577.    */
  4578.  
  4579.    [caption] nvarchar(max)  NOT NULL,
  4580.  
  4581.    /*
  4582.    *   SSMA warning messages:
  4583.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4584.    */
  4585.  
  4586.    [lang] nchar(5) DEFAULT N''  NOT NULL
  4587. )
  4588. GO
  4589. BEGIN TRY
  4590.     EXEC sp_addextendedproperty
  4591.         N'MS_SSMA_SOURCE', N'dbo.navigation_translation',
  4592.         N'SCHEMA', N'dbo',
  4593.         N'TABLE', N'navigation_translation'
  4594. END TRY
  4595. BEGIN CATCH
  4596.     IF (@@TRANCOUNT > 0) ROLLBACK
  4597.     PRINT ERROR_MESSAGE()
  4598. END CATCH
  4599. GO
  4600. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'notification_mail'  AND sc.name=N'dbo'  AND type in (N'U'))
  4601. BEGIN
  4602.  
  4603.   DECLARE @drop_statement nvarchar(500)
  4604.  
  4605.   DECLARE drop_cursor CURSOR FOR
  4606.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4607.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4608.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4609.       WHERE fk.referenced_object_id =
  4610.           (
  4611.              SELECT so.object_id
  4612.              FROM sys.objects so JOIN sys.schemas sc
  4613.              ON so.schema_id = sc.schema_id
  4614.              WHERE so.name = N'notification_mail'  AND sc.name=N'dbo'  AND type in (N'U')
  4615.            )
  4616.  
  4617.   OPEN drop_cursor
  4618.  
  4619.   FETCH NEXT FROM drop_cursor
  4620.   INTO @drop_statement
  4621.  
  4622.   WHILE @@FETCH_STATUS = 0
  4623.   BEGIN
  4624.      EXEC (@drop_statement)
  4625.  
  4626.      FETCH NEXT FROM drop_cursor
  4627.      INTO @drop_statement
  4628.   END
  4629.  
  4630.   CLOSE drop_cursor
  4631.   DEALLOCATE drop_cursor
  4632.  
  4633.   DROP TABLE [dbo].[notification_mail]
  4634. END
  4635. GO
  4636.  
  4637. SET ANSI_NULLS ON
  4638. GO
  4639. SET QUOTED_IDENTIFIER ON
  4640. GO
  4641. CREATE TABLE
  4642. [dbo].[notification_mail]
  4643. (
  4644.  
  4645.    /*
  4646.    *   SSMA informational messages:
  4647.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  4648.    */
  4649.  
  4650.    [id] int IDENTITY(1, 1)  NOT NULL,
  4651.  
  4652.    /*
  4653.    *   SSMA warning messages:
  4654.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4655.  
  4656.    *   SSMA informational messages:
  4657.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Notification Identifier Name'.
  4658.    */
  4659.  
  4660.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  4661.  
  4662.    /*
  4663.    *   SSMA warning messages:
  4664.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4665.  
  4666.    *   SSMA informational messages:
  4667.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Notification Template Renderer'.
  4668.    */
  4669.  
  4670.    [renderer] nvarchar(64) DEFAULT N'twig'  NOT NULL,
  4671.  
  4672.    /*
  4673.    *   SSMA informational messages:
  4674.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Notification Enabled'.
  4675.    *   M2SS0052: string literal was converted to NUMERIC literal
  4676.    */
  4677.  
  4678.    [is_enabled] smallint DEFAULT 1  NOT NULL
  4679. )
  4680. GO
  4681. BEGIN TRY
  4682.     EXEC sp_addextendedproperty
  4683.         N'MS_SSMA_SOURCE', N'dbo.notification_mail',
  4684.         N'SCHEMA', N'dbo',
  4685.         N'TABLE', N'notification_mail'
  4686. END TRY
  4687. BEGIN CATCH
  4688.     IF (@@TRANCOUNT > 0) ROLLBACK
  4689.     PRINT ERROR_MESSAGE()
  4690. END CATCH
  4691. GO
  4692. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'notification_mail_translation'  AND sc.name=N'dbo'  AND type in (N'U'))
  4693. BEGIN
  4694.  
  4695.   DECLARE @drop_statement nvarchar(500)
  4696.  
  4697.   DECLARE drop_cursor CURSOR FOR
  4698.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4699.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4700.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4701.       WHERE fk.referenced_object_id =
  4702.           (
  4703.              SELECT so.object_id
  4704.              FROM sys.objects so JOIN sys.schemas sc
  4705.              ON so.schema_id = sc.schema_id
  4706.              WHERE so.name = N'notification_mail_translation'  AND sc.name=N'dbo'  AND type in (N'U')
  4707.            )
  4708.  
  4709.   OPEN drop_cursor
  4710.  
  4711.   FETCH NEXT FROM drop_cursor
  4712.   INTO @drop_statement
  4713.  
  4714.   WHILE @@FETCH_STATUS = 0
  4715.   BEGIN
  4716.      EXEC (@drop_statement)
  4717.  
  4718.      FETCH NEXT FROM drop_cursor
  4719.      INTO @drop_statement
  4720.   END
  4721.  
  4722.   CLOSE drop_cursor
  4723.   DEALLOCATE drop_cursor
  4724.  
  4725.   DROP TABLE [dbo].[notification_mail_translation]
  4726. END
  4727. GO
  4728.  
  4729. SET ANSI_NULLS ON
  4730. GO
  4731. SET QUOTED_IDENTIFIER ON
  4732. GO
  4733. CREATE TABLE
  4734. [dbo].[notification_mail_translation]
  4735. (
  4736.  
  4737.    /*
  4738.    *   SSMA informational messages:
  4739.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  4740.    *   M2SS0052: string literal was converted to NUMERIC literal
  4741.    */
  4742.  
  4743.    [id] int DEFAULT 0  NOT NULL,
  4744.  
  4745.    /*
  4746.    *   SSMA warning messages:
  4747.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4748.  
  4749.    *   SSMA informational messages:
  4750.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Notification Title'.
  4751.    */
  4752.  
  4753.    [title] nvarchar(64) DEFAULT N''  NOT NULL,
  4754.  
  4755.    /*
  4756.    *   SSMA warning messages:
  4757.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4758.  
  4759.    *   SSMA informational messages:
  4760.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Notification Template'.
  4761.    */
  4762.  
  4763.    [template] nvarchar(max)  NOT NULL,
  4764.  
  4765.    /*
  4766.    *   SSMA warning messages:
  4767.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4768.    */
  4769.  
  4770.    [lang] nchar(5) DEFAULT N''  NOT NULL
  4771. )
  4772. GO
  4773. BEGIN TRY
  4774.     EXEC sp_addextendedproperty
  4775.         N'MS_SSMA_SOURCE', N'dbo.notification_mail_translation',
  4776.         N'SCHEMA', N'dbo',
  4777.         N'TABLE', N'notification_mail_translation'
  4778. END TRY
  4779. BEGIN CATCH
  4780.     IF (@@TRANCOUNT > 0) ROLLBACK
  4781.     PRINT ERROR_MESSAGE()
  4782. END CATCH
  4783. GO
  4784. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'o_auth_admin_token'  AND sc.name=N'dbo'  AND type in (N'U'))
  4785. BEGIN
  4786.  
  4787.   DECLARE @drop_statement nvarchar(500)
  4788.  
  4789.   DECLARE drop_cursor CURSOR FOR
  4790.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4791.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4792.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4793.       WHERE fk.referenced_object_id =
  4794.           (
  4795.              SELECT so.object_id
  4796.              FROM sys.objects so JOIN sys.schemas sc
  4797.              ON so.schema_id = sc.schema_id
  4798.              WHERE so.name = N'o_auth_admin_token'  AND sc.name=N'dbo'  AND type in (N'U')
  4799.            )
  4800.  
  4801.   OPEN drop_cursor
  4802.  
  4803.   FETCH NEXT FROM drop_cursor
  4804.   INTO @drop_statement
  4805.  
  4806.   WHILE @@FETCH_STATUS = 0
  4807.   BEGIN
  4808.      EXEC (@drop_statement)
  4809.  
  4810.      FETCH NEXT FROM drop_cursor
  4811.      INTO @drop_statement
  4812.   END
  4813.  
  4814.   CLOSE drop_cursor
  4815.   DEALLOCATE drop_cursor
  4816.  
  4817.   DROP TABLE [dbo].[o_auth_admin_token]
  4818. END
  4819. GO
  4820.  
  4821. SET ANSI_NULLS ON
  4822. GO
  4823. SET QUOTED_IDENTIFIER ON
  4824. GO
  4825. CREATE TABLE
  4826. [dbo].[o_auth_admin_token]
  4827. (
  4828.  
  4829.    /*
  4830.    *   SSMA informational messages:
  4831.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  4832.    */
  4833.  
  4834.    [id] int IDENTITY(1, 1)  NOT NULL,
  4835.  
  4836.    /*
  4837.    *   SSMA informational messages:
  4838.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'OAuth Consumer id'.
  4839.    */
  4840.  
  4841.    [oauth_consumer_id] int  NOT NULL,
  4842.  
  4843.    /*
  4844.    *   SSMA warning messages:
  4845.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4846.  
  4847.    *   SSMA informational messages:
  4848.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Key string of this token'.
  4849.    */
  4850.  
  4851.    [key_string] nvarchar(16) DEFAULT N''  NOT NULL,
  4852.  
  4853.    /*
  4854.    *   SSMA warning messages:
  4855.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4856.  
  4857.    *   SSMA informational messages:
  4858.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Secret string of this token'.
  4859.    */
  4860.  
  4861.    [secret] nvarchar(32) DEFAULT N''  NOT NULL,
  4862.  
  4863.    /*
  4864.    *   SSMA warning messages:
  4865.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4866.  
  4867.    *   SSMA informational messages:
  4868.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Token type'.
  4869.    */
  4870.  
  4871.    [type] nvarchar(255) DEFAULT N'request'  NULL,
  4872.  
  4873.    /*
  4874.    *   SSMA informational messages:
  4875.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Activation flag'.
  4876.    *   M2SS0052: string literal was converted to NUMERIC literal
  4877.    */
  4878.  
  4879.    [is_active] smallint DEFAULT 1  NOT NULL,
  4880.  
  4881.    /*
  4882.    *   SSMA warning messages:
  4883.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4884.  
  4885.    *   SSMA informational messages:
  4886.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Callback url'.
  4887.    */
  4888.  
  4889.    [callback_url] nvarchar(max)  NULL,
  4890.  
  4891.    /*
  4892.    *   SSMA warning messages:
  4893.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4894.  
  4895.    *   SSMA informational messages:
  4896.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Token verifier'.
  4897.    */
  4898.  
  4899.    [verifier] nvarchar(max)  NULL,
  4900.    [created_at] datetime2(0)  NOT NULL,
  4901.    [updated_at] datetime2(0)  NOT NULL
  4902. )
  4903. GO
  4904. BEGIN TRY
  4905.     EXEC sp_addextendedproperty
  4906.         N'MS_SSMA_SOURCE', N'dbo.o_auth_admin_token',
  4907.         N'SCHEMA', N'dbo',
  4908.         N'TABLE', N'o_auth_admin_token'
  4909. END TRY
  4910. BEGIN CATCH
  4911.     IF (@@TRANCOUNT > 0) ROLLBACK
  4912.     PRINT ERROR_MESSAGE()
  4913. END CATCH
  4914. GO
  4915. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'o_auth_member_token'  AND sc.name=N'dbo'  AND type in (N'U'))
  4916. BEGIN
  4917.  
  4918.   DECLARE @drop_statement nvarchar(500)
  4919.  
  4920.   DECLARE drop_cursor CURSOR FOR
  4921.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  4922.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  4923.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  4924.       WHERE fk.referenced_object_id =
  4925.           (
  4926.              SELECT so.object_id
  4927.              FROM sys.objects so JOIN sys.schemas sc
  4928.              ON so.schema_id = sc.schema_id
  4929.              WHERE so.name = N'o_auth_member_token'  AND sc.name=N'dbo'  AND type in (N'U')
  4930.            )
  4931.  
  4932.   OPEN drop_cursor
  4933.  
  4934.   FETCH NEXT FROM drop_cursor
  4935.   INTO @drop_statement
  4936.  
  4937.   WHILE @@FETCH_STATUS = 0
  4938.   BEGIN
  4939.      EXEC (@drop_statement)
  4940.  
  4941.      FETCH NEXT FROM drop_cursor
  4942.      INTO @drop_statement
  4943.   END
  4944.  
  4945.   CLOSE drop_cursor
  4946.   DEALLOCATE drop_cursor
  4947.  
  4948.   DROP TABLE [dbo].[o_auth_member_token]
  4949. END
  4950. GO
  4951.  
  4952. SET ANSI_NULLS ON
  4953. GO
  4954. SET QUOTED_IDENTIFIER ON
  4955. GO
  4956. CREATE TABLE
  4957. [dbo].[o_auth_member_token]
  4958. (
  4959.  
  4960.    /*
  4961.    *   SSMA informational messages:
  4962.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  4963.    */
  4964.  
  4965.    [id] int IDENTITY(1, 1)  NOT NULL,
  4966.  
  4967.    /*
  4968.    *   SSMA informational messages:
  4969.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'OAuth Consumer id'.
  4970.    */
  4971.  
  4972.    [oauth_consumer_id] int  NOT NULL,
  4973.  
  4974.    /*
  4975.    *   SSMA warning messages:
  4976.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4977.  
  4978.    *   SSMA informational messages:
  4979.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Key string of this token'.
  4980.    */
  4981.  
  4982.    [key_string] nvarchar(16) DEFAULT N''  NOT NULL,
  4983.  
  4984.    /*
  4985.    *   SSMA warning messages:
  4986.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4987.  
  4988.    *   SSMA informational messages:
  4989.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Secret string of this token'.
  4990.    */
  4991.  
  4992.    [secret] nvarchar(32) DEFAULT N''  NOT NULL,
  4993.  
  4994.    /*
  4995.    *   SSMA warning messages:
  4996.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  4997.  
  4998.    *   SSMA informational messages:
  4999.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Token type'.
  5000.    */
  5001.  
  5002.    [type] nvarchar(255) DEFAULT N'request'  NULL,
  5003.  
  5004.    /*
  5005.    *   SSMA informational messages:
  5006.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Activation flag'.
  5007.    *   M2SS0052: string literal was converted to NUMERIC literal
  5008.    */
  5009.  
  5010.    [is_active] smallint DEFAULT 1  NOT NULL,
  5011.  
  5012.    /*
  5013.    *   SSMA warning messages:
  5014.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5015.  
  5016.    *   SSMA informational messages:
  5017.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Callback url'.
  5018.    */
  5019.  
  5020.    [callback_url] nvarchar(max)  NULL,
  5021.  
  5022.    /*
  5023.    *   SSMA warning messages:
  5024.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5025.  
  5026.    *   SSMA informational messages:
  5027.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Token verifier'.
  5028.    */
  5029.  
  5030.    [verifier] nvarchar(max)  NULL,
  5031.  
  5032.    /*
  5033.    *   SSMA informational messages:
  5034.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  5035.    */
  5036.  
  5037.    [member_id] int DEFAULT NULL  NULL,
  5038.    [created_at] datetime2(0)  NOT NULL,
  5039.    [updated_at] datetime2(0)  NOT NULL
  5040. )
  5041. GO
  5042. BEGIN TRY
  5043.     EXEC sp_addextendedproperty
  5044.         N'MS_SSMA_SOURCE', N'dbo.o_auth_member_token',
  5045.         N'SCHEMA', N'dbo',
  5046.         N'TABLE', N'o_auth_member_token'
  5047. END TRY
  5048. BEGIN CATCH
  5049.     IF (@@TRANCOUNT > 0) ROLLBACK
  5050.     PRINT ERROR_MESSAGE()
  5051. END CATCH
  5052. GO
  5053. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'oauth_consumer'  AND sc.name=N'dbo'  AND type in (N'U'))
  5054. BEGIN
  5055.  
  5056.   DECLARE @drop_statement nvarchar(500)
  5057.  
  5058.   DECLARE drop_cursor CURSOR FOR
  5059.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5060.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5061.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5062.       WHERE fk.referenced_object_id =
  5063.           (
  5064.              SELECT so.object_id
  5065.              FROM sys.objects so JOIN sys.schemas sc
  5066.              ON so.schema_id = sc.schema_id
  5067.              WHERE so.name = N'oauth_consumer'  AND sc.name=N'dbo'  AND type in (N'U')
  5068.            )
  5069.  
  5070.   OPEN drop_cursor
  5071.  
  5072.   FETCH NEXT FROM drop_cursor
  5073.   INTO @drop_statement
  5074.  
  5075.   WHILE @@FETCH_STATUS = 0
  5076.   BEGIN
  5077.      EXEC (@drop_statement)
  5078.  
  5079.      FETCH NEXT FROM drop_cursor
  5080.      INTO @drop_statement
  5081.   END
  5082.  
  5083.   CLOSE drop_cursor
  5084.   DEALLOCATE drop_cursor
  5085.  
  5086.   DROP TABLE [dbo].[oauth_consumer]
  5087. END
  5088. GO
  5089.  
  5090. SET ANSI_NULLS ON
  5091. GO
  5092. SET QUOTED_IDENTIFIER ON
  5093. GO
  5094. CREATE TABLE
  5095. [dbo].[oauth_consumer]
  5096. (
  5097.  
  5098.    /*
  5099.    *   SSMA informational messages:
  5100.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  5101.    */
  5102.  
  5103.    [id] int IDENTITY(1, 1)  NOT NULL,
  5104.  
  5105.    /*
  5106.    *   SSMA warning messages:
  5107.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5108.  
  5109.    *   SSMA informational messages:
  5110.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Consumer name'.
  5111.    */
  5112.  
  5113.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  5114.  
  5115.    /*
  5116.    *   SSMA warning messages:
  5117.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5118.  
  5119.    *   SSMA informational messages:
  5120.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Consumer description'.
  5121.    */
  5122.  
  5123.    [description] nvarchar(max)  NULL,
  5124.  
  5125.    /*
  5126.    *   SSMA warning messages:
  5127.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5128.  
  5129.    *   SSMA informational messages:
  5130.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Token for this consumer'.
  5131.    */
  5132.  
  5133.    [key_string] nvarchar(16) DEFAULT N''  NOT NULL,
  5134.  
  5135.    /*
  5136.    *   SSMA warning messages:
  5137.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5138.  
  5139.    *   SSMA informational messages:
  5140.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Password for this consumer'.
  5141.    */
  5142.  
  5143.    [secret] nvarchar(32) DEFAULT N''  NOT NULL,
  5144.  
  5145.    /*
  5146.    *   SSMA informational messages:
  5147.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Image file id of this consumer'.
  5148.    */
  5149.  
  5150.    [file_id] int DEFAULT NULL  NULL,
  5151.  
  5152.    /*
  5153.    *   SSMA warning messages:
  5154.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5155.  
  5156.    *   SSMA informational messages:
  5157.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'API list that this consumer uses'.
  5158.    */
  5159.  
  5160.    [using_apis] nvarchar(max)  NULL,
  5161.  
  5162.    /*
  5163.    *   SSMA informational messages:
  5164.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  5165.    */
  5166.  
  5167.    [member_id] int DEFAULT NULL  NULL,
  5168.    [created_at] datetime2(0)  NOT NULL,
  5169.    [updated_at] datetime2(0)  NOT NULL
  5170. )
  5171. GO
  5172. BEGIN TRY
  5173.     EXEC sp_addextendedproperty
  5174.         N'MS_SSMA_SOURCE', N'dbo.oauth_consumer',
  5175.         N'SCHEMA', N'dbo',
  5176.         N'TABLE', N'oauth_consumer'
  5177. END TRY
  5178. BEGIN CATCH
  5179.     IF (@@TRANCOUNT > 0) ROLLBACK
  5180.     PRINT ERROR_MESSAGE()
  5181. END CATCH
  5182. GO
  5183. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'openid_trust_log'  AND sc.name=N'dbo'  AND type in (N'U'))
  5184. BEGIN
  5185.  
  5186.   DECLARE @drop_statement nvarchar(500)
  5187.  
  5188.   DECLARE drop_cursor CURSOR FOR
  5189.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5190.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5191.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5192.       WHERE fk.referenced_object_id =
  5193.           (
  5194.              SELECT so.object_id
  5195.              FROM sys.objects so JOIN sys.schemas sc
  5196.              ON so.schema_id = sc.schema_id
  5197.              WHERE so.name = N'openid_trust_log'  AND sc.name=N'dbo'  AND type in (N'U')
  5198.            )
  5199.  
  5200.   OPEN drop_cursor
  5201.  
  5202.   FETCH NEXT FROM drop_cursor
  5203.   INTO @drop_statement
  5204.  
  5205.   WHILE @@FETCH_STATUS = 0
  5206.   BEGIN
  5207.      EXEC (@drop_statement)
  5208.  
  5209.      FETCH NEXT FROM drop_cursor
  5210.      INTO @drop_statement
  5211.   END
  5212.  
  5213.   CLOSE drop_cursor
  5214.   DEALLOCATE drop_cursor
  5215.  
  5216.   DROP TABLE [dbo].[openid_trust_log]
  5217. END
  5218. GO
  5219.  
  5220. SET ANSI_NULLS ON
  5221. GO
  5222. SET QUOTED_IDENTIFIER ON
  5223. GO
  5224. CREATE TABLE
  5225. [dbo].[openid_trust_log]
  5226. (
  5227.  
  5228.    /*
  5229.    *   SSMA informational messages:
  5230.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  5231.    */
  5232.  
  5233.    [id] int IDENTITY(1, 1)  NOT NULL,
  5234.  
  5235.    /*
  5236.    *   SSMA informational messages:
  5237.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Member id'.
  5238.    */
  5239.  
  5240.    [member_id] int DEFAULT NULL  NULL,
  5241.  
  5242.    /*
  5243.    *   SSMA warning messages:
  5244.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5245.  
  5246.    *   SSMA informational messages:
  5247.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'URI for RP'.
  5248.    */
  5249.  
  5250.    [uri] nvarchar(max)  NULL,
  5251.  
  5252.    /*
  5253.    *   SSMA warning messages:
  5254.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5255.  
  5256.    *   SSMA informational messages:
  5257.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Hashed URI for RP'.
  5258.    */
  5259.  
  5260.    [uri_key] nvarchar(32) DEFAULT NULL  NULL,
  5261.  
  5262.    /*
  5263.    *   SSMA informational messages:
  5264.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'A permanent flag'.
  5265.    */
  5266.  
  5267.    [is_permanent] smallint DEFAULT NULL  NULL,
  5268.    [created_at] datetime2(0)  NOT NULL,
  5269.    [updated_at] datetime2(0)  NOT NULL
  5270. )
  5271. GO
  5272. BEGIN TRY
  5273.     EXEC sp_addextendedproperty
  5274.         N'MS_SSMA_SOURCE', N'dbo.openid_trust_log',
  5275.         N'SCHEMA', N'dbo',
  5276.         N'TABLE', N'openid_trust_log'
  5277. END TRY
  5278. BEGIN CATCH
  5279.     IF (@@TRANCOUNT > 0) ROLLBACK
  5280.     PRINT ERROR_MESSAGE()
  5281. END CATCH
  5282. GO
  5283. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'plugin'  AND sc.name=N'dbo'  AND type in (N'U'))
  5284. BEGIN
  5285.  
  5286.   DECLARE @drop_statement nvarchar(500)
  5287.  
  5288.   DECLARE drop_cursor CURSOR FOR
  5289.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5290.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5291.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5292.       WHERE fk.referenced_object_id =
  5293.           (
  5294.              SELECT so.object_id
  5295.              FROM sys.objects so JOIN sys.schemas sc
  5296.              ON so.schema_id = sc.schema_id
  5297.              WHERE so.name = N'plugin'  AND sc.name=N'dbo'  AND type in (N'U')
  5298.            )
  5299.  
  5300.   OPEN drop_cursor
  5301.  
  5302.   FETCH NEXT FROM drop_cursor
  5303.   INTO @drop_statement
  5304.  
  5305.   WHILE @@FETCH_STATUS = 0
  5306.   BEGIN
  5307.      EXEC (@drop_statement)
  5308.  
  5309.      FETCH NEXT FROM drop_cursor
  5310.      INTO @drop_statement
  5311.   END
  5312.  
  5313.   CLOSE drop_cursor
  5314.   DEALLOCATE drop_cursor
  5315.  
  5316.   DROP TABLE [dbo].[plugin]
  5317. END
  5318. GO
  5319.  
  5320. SET ANSI_NULLS ON
  5321. GO
  5322. SET QUOTED_IDENTIFIER ON
  5323. GO
  5324. CREATE TABLE
  5325. [dbo].[plugin]
  5326. (
  5327.  
  5328.    /*
  5329.    *   SSMA informational messages:
  5330.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  5331.    */
  5332.  
  5333.    [id] int IDENTITY(1, 1)  NOT NULL,
  5334.  
  5335.    /*
  5336.    *   SSMA warning messages:
  5337.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5338.  
  5339.    *   SSMA informational messages:
  5340.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Nickname'.
  5341.    */
  5342.  
  5343.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  5344.  
  5345.    /*
  5346.    *   SSMA informational messages:
  5347.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Notification Enabled'.
  5348.    *   M2SS0052: string literal was converted to NUMERIC literal
  5349.    */
  5350.  
  5351.    [is_enabled] smallint DEFAULT 1  NOT NULL,
  5352.    [created_at] datetime2(0)  NOT NULL,
  5353.    [updated_at] datetime2(0)  NOT NULL
  5354. )
  5355. GO
  5356. BEGIN TRY
  5357.     EXEC sp_addextendedproperty
  5358.         N'MS_SSMA_SOURCE', N'dbo.plugin',
  5359.         N'SCHEMA', N'dbo',
  5360.         N'TABLE', N'plugin'
  5361. END TRY
  5362. BEGIN CATCH
  5363.     IF (@@TRANCOUNT > 0) ROLLBACK
  5364.     PRINT ERROR_MESSAGE()
  5365. END CATCH
  5366. GO
  5367. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'profile'  AND sc.name=N'dbo'  AND type in (N'U'))
  5368. BEGIN
  5369.  
  5370.   DECLARE @drop_statement nvarchar(500)
  5371.  
  5372.   DECLARE drop_cursor CURSOR FOR
  5373.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5374.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5375.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5376.       WHERE fk.referenced_object_id =
  5377.           (
  5378.              SELECT so.object_id
  5379.              FROM sys.objects so JOIN sys.schemas sc
  5380.              ON so.schema_id = sc.schema_id
  5381.              WHERE so.name = N'profile'  AND sc.name=N'dbo'  AND type in (N'U')
  5382.            )
  5383.  
  5384.   OPEN drop_cursor
  5385.  
  5386.   FETCH NEXT FROM drop_cursor
  5387.   INTO @drop_statement
  5388.  
  5389.   WHILE @@FETCH_STATUS = 0
  5390.   BEGIN
  5391.      EXEC (@drop_statement)
  5392.  
  5393.      FETCH NEXT FROM drop_cursor
  5394.      INTO @drop_statement
  5395.   END
  5396.  
  5397.   CLOSE drop_cursor
  5398.   DEALLOCATE drop_cursor
  5399.  
  5400.   DROP TABLE [dbo].[profile]
  5401. END
  5402. GO
  5403.  
  5404. SET ANSI_NULLS ON
  5405. GO
  5406. SET QUOTED_IDENTIFIER ON
  5407. GO
  5408. CREATE TABLE
  5409. [dbo].[profile]
  5410. (
  5411.  
  5412.    /*
  5413.    *   SSMA informational messages:
  5414.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  5415.    */
  5416.  
  5417.    [id] int IDENTITY(5, 1)  NOT NULL,
  5418.  
  5419.    /*
  5420.    *   SSMA warning messages:
  5421.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5422.  
  5423.    *   SSMA informational messages:
  5424.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Identified profile name (ASCII)'.
  5425.    */
  5426.  
  5427.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  5428.  
  5429.    /*
  5430.    *   SSMA informational messages:
  5431.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'This is a required'.
  5432.    *   M2SS0052: string literal was converted to NUMERIC literal
  5433.    */
  5434.  
  5435.    [is_required] smallint DEFAULT 0  NOT NULL,
  5436.  
  5437.    /*
  5438.    *   SSMA informational messages:
  5439.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Cannot select duplicate item'.
  5440.    *   M2SS0052: string literal was converted to NUMERIC literal
  5441.    */
  5442.  
  5443.    [is_unique] smallint DEFAULT 0  NOT NULL,
  5444.  
  5445.    /*
  5446.    *   SSMA informational messages:
  5447.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Settable public flag'.
  5448.    *   M2SS0052: string literal was converted to NUMERIC literal
  5449.    */
  5450.  
  5451.    [is_edit_public_flag] smallint DEFAULT 0  NOT NULL,
  5452.  
  5453.    /*
  5454.    *   SSMA informational messages:
  5455.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Default of public flag'.
  5456.    *   M2SS0052: string literal was converted to NUMERIC literal
  5457.    */
  5458.  
  5459.    [default_public_flag] smallint DEFAULT 1  NOT NULL,
  5460.  
  5461.    /*
  5462.    *   SSMA warning messages:
  5463.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5464.  
  5465.    *   SSMA informational messages:
  5466.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Form type to input/select'.
  5467.    */
  5468.  
  5469.    [form_type] nvarchar(32) DEFAULT N''  NOT NULL,
  5470.  
  5471.    /*
  5472.    *   SSMA warning messages:
  5473.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5474.  
  5475.    *   SSMA informational messages:
  5476.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Type of input value'.
  5477.    */
  5478.  
  5479.    [value_type] nvarchar(32) DEFAULT N''  NOT NULL,
  5480.  
  5481.    /*
  5482.    *   SSMA informational messages:
  5483.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Shows when registeration'.
  5484.    *   M2SS0052: string literal was converted to NUMERIC literal
  5485.    */
  5486.  
  5487.    [is_disp_regist] smallint DEFAULT 0  NOT NULL,
  5488.  
  5489.    /*
  5490.    *   SSMA informational messages:
  5491.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Shows when edit'.
  5492.    *   M2SS0052: string literal was converted to NUMERIC literal
  5493.    */
  5494.  
  5495.    [is_disp_config] smallint DEFAULT 0  NOT NULL,
  5496.  
  5497.    /*
  5498.    *   SSMA informational messages:
  5499.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Shows when searching'.
  5500.    *   M2SS0052: string literal was converted to NUMERIC literal
  5501.    */
  5502.  
  5503.    [is_disp_search] smallint DEFAULT 0  NOT NULL,
  5504.  
  5505.    /*
  5506.    *   SSMA informational messages:
  5507.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Flag for adding public_flag for publishing to web'.
  5508.    *   M2SS0052: string literal was converted to NUMERIC literal
  5509.    */
  5510.  
  5511.    [is_public_web] smallint DEFAULT 0  NOT NULL,
  5512.  
  5513.    /*
  5514.    *   SSMA warning messages:
  5515.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5516.  
  5517.    *   SSMA informational messages:
  5518.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Regular expression'.
  5519.    */
  5520.  
  5521.    [value_regexp] nvarchar(max)  NULL,
  5522.  
  5523.    /*
  5524.    *   SSMA warning messages:
  5525.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5526.  
  5527.    *   SSMA informational messages:
  5528.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Minimum value'.
  5529.    */
  5530.  
  5531.    [value_min] nvarchar(32) DEFAULT NULL  NULL,
  5532.  
  5533.    /*
  5534.    *   SSMA warning messages:
  5535.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5536.  
  5537.    *   SSMA informational messages:
  5538.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Maximum value'.
  5539.    */
  5540.  
  5541.    [value_max] nvarchar(32) DEFAULT NULL  NULL,
  5542.  
  5543.    /*
  5544.    *   SSMA informational messages:
  5545.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Order to sort'.
  5546.    */
  5547.  
  5548.    [sort_order] int DEFAULT NULL  NULL,
  5549.    [created_at] datetime2(0)  NOT NULL,
  5550.    [updated_at] datetime2(0)  NOT NULL
  5551. )
  5552. GO
  5553. BEGIN TRY
  5554.     EXEC sp_addextendedproperty
  5555.         N'MS_SSMA_SOURCE', N'dbo.profile',
  5556.         N'SCHEMA', N'dbo',
  5557.         N'TABLE', N'profile'
  5558. END TRY
  5559. BEGIN CATCH
  5560.     IF (@@TRANCOUNT > 0) ROLLBACK
  5561.     PRINT ERROR_MESSAGE()
  5562. END CATCH
  5563. GO
  5564. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'profile_option'  AND sc.name=N'dbo'  AND type in (N'U'))
  5565. BEGIN
  5566.  
  5567.   DECLARE @drop_statement nvarchar(500)
  5568.  
  5569.   DECLARE drop_cursor CURSOR FOR
  5570.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5571.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5572.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5573.       WHERE fk.referenced_object_id =
  5574.           (
  5575.              SELECT so.object_id
  5576.              FROM sys.objects so JOIN sys.schemas sc
  5577.              ON so.schema_id = sc.schema_id
  5578.              WHERE so.name = N'profile_option'  AND sc.name=N'dbo'  AND type in (N'U')
  5579.            )
  5580.  
  5581.   OPEN drop_cursor
  5582.  
  5583.   FETCH NEXT FROM drop_cursor
  5584.   INTO @drop_statement
  5585.  
  5586.   WHILE @@FETCH_STATUS = 0
  5587.   BEGIN
  5588.      EXEC (@drop_statement)
  5589.  
  5590.      FETCH NEXT FROM drop_cursor
  5591.      INTO @drop_statement
  5592.   END
  5593.  
  5594.   CLOSE drop_cursor
  5595.   DEALLOCATE drop_cursor
  5596.  
  5597.   DROP TABLE [dbo].[profile_option]
  5598. END
  5599. GO
  5600.  
  5601. SET ANSI_NULLS ON
  5602. GO
  5603. SET QUOTED_IDENTIFIER ON
  5604. GO
  5605. CREATE TABLE
  5606. [dbo].[profile_option]
  5607. (
  5608.  
  5609.    /*
  5610.    *   SSMA informational messages:
  5611.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  5612.    */
  5613.  
  5614.    [id] int IDENTITY(1, 1)  NOT NULL,
  5615.  
  5616.    /*
  5617.    *   SSMA informational messages:
  5618.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Profile id'.
  5619.    */
  5620.  
  5621.    [profile_id] int  NOT NULL,
  5622.  
  5623.    /*
  5624.    *   SSMA informational messages:
  5625.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Order to sort'.
  5626.    */
  5627.  
  5628.    [sort_order] int DEFAULT NULL  NULL,
  5629.    [created_at] datetime2(0)  NOT NULL,
  5630.    [updated_at] datetime2(0)  NOT NULL
  5631. )
  5632. GO
  5633. BEGIN TRY
  5634.     EXEC sp_addextendedproperty
  5635.         N'MS_SSMA_SOURCE', N'dbo.profile_option',
  5636.         N'SCHEMA', N'dbo',
  5637.         N'TABLE', N'profile_option'
  5638. END TRY
  5639. BEGIN CATCH
  5640.     IF (@@TRANCOUNT > 0) ROLLBACK
  5641.     PRINT ERROR_MESSAGE()
  5642. END CATCH
  5643. GO
  5644. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'profile_option_translation'  AND sc.name=N'dbo'  AND type in (N'U'))
  5645. BEGIN
  5646.  
  5647.   DECLARE @drop_statement nvarchar(500)
  5648.  
  5649.   DECLARE drop_cursor CURSOR FOR
  5650.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5651.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5652.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5653.       WHERE fk.referenced_object_id =
  5654.           (
  5655.              SELECT so.object_id
  5656.              FROM sys.objects so JOIN sys.schemas sc
  5657.              ON so.schema_id = sc.schema_id
  5658.              WHERE so.name = N'profile_option_translation'  AND sc.name=N'dbo'  AND type in (N'U')
  5659.            )
  5660.  
  5661.   OPEN drop_cursor
  5662.  
  5663.   FETCH NEXT FROM drop_cursor
  5664.   INTO @drop_statement
  5665.  
  5666.   WHILE @@FETCH_STATUS = 0
  5667.   BEGIN
  5668.      EXEC (@drop_statement)
  5669.  
  5670.      FETCH NEXT FROM drop_cursor
  5671.      INTO @drop_statement
  5672.   END
  5673.  
  5674.   CLOSE drop_cursor
  5675.   DEALLOCATE drop_cursor
  5676.  
  5677.   DROP TABLE [dbo].[profile_option_translation]
  5678. END
  5679. GO
  5680.  
  5681. SET ANSI_NULLS ON
  5682. GO
  5683. SET QUOTED_IDENTIFIER ON
  5684. GO
  5685. CREATE TABLE
  5686. [dbo].[profile_option_translation]
  5687. (
  5688.  
  5689.    /*
  5690.    *   SSMA informational messages:
  5691.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  5692.    *   M2SS0052: string literal was converted to NUMERIC literal
  5693.    */
  5694.  
  5695.    [id] int DEFAULT 0  NOT NULL,
  5696.  
  5697.    /*
  5698.    *   SSMA warning messages:
  5699.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5700.  
  5701.    *   SSMA informational messages:
  5702.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Choice'.
  5703.    */
  5704.  
  5705.    [value] nvarchar(max)  NULL,
  5706.  
  5707.    /*
  5708.    *   SSMA warning messages:
  5709.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5710.    */
  5711.  
  5712.    [lang] nchar(5) DEFAULT N''  NOT NULL
  5713. )
  5714. GO
  5715. BEGIN TRY
  5716.     EXEC sp_addextendedproperty
  5717.         N'MS_SSMA_SOURCE', N'dbo.profile_option_translation',
  5718.         N'SCHEMA', N'dbo',
  5719.         N'TABLE', N'profile_option_translation'
  5720. END TRY
  5721. BEGIN CATCH
  5722.     IF (@@TRANCOUNT > 0) ROLLBACK
  5723.     PRINT ERROR_MESSAGE()
  5724. END CATCH
  5725. GO
  5726. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'profile_translation'  AND sc.name=N'dbo'  AND type in (N'U'))
  5727. BEGIN
  5728.  
  5729.   DECLARE @drop_statement nvarchar(500)
  5730.  
  5731.   DECLARE drop_cursor CURSOR FOR
  5732.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5733.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5734.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5735.       WHERE fk.referenced_object_id =
  5736.           (
  5737.              SELECT so.object_id
  5738.              FROM sys.objects so JOIN sys.schemas sc
  5739.              ON so.schema_id = sc.schema_id
  5740.              WHERE so.name = N'profile_translation'  AND sc.name=N'dbo'  AND type in (N'U')
  5741.            )
  5742.  
  5743.   OPEN drop_cursor
  5744.  
  5745.   FETCH NEXT FROM drop_cursor
  5746.   INTO @drop_statement
  5747.  
  5748.   WHILE @@FETCH_STATUS = 0
  5749.   BEGIN
  5750.      EXEC (@drop_statement)
  5751.  
  5752.      FETCH NEXT FROM drop_cursor
  5753.      INTO @drop_statement
  5754.   END
  5755.  
  5756.   CLOSE drop_cursor
  5757.   DEALLOCATE drop_cursor
  5758.  
  5759.   DROP TABLE [dbo].[profile_translation]
  5760. END
  5761. GO
  5762.  
  5763. SET ANSI_NULLS ON
  5764. GO
  5765. SET QUOTED_IDENTIFIER ON
  5766. GO
  5767. CREATE TABLE
  5768. [dbo].[profile_translation]
  5769. (
  5770.  
  5771.    /*
  5772.    *   SSMA informational messages:
  5773.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  5774.    *   M2SS0052: string literal was converted to NUMERIC literal
  5775.    */
  5776.  
  5777.    [id] int DEFAULT 0  NOT NULL,
  5778.  
  5779.    /*
  5780.    *   SSMA warning messages:
  5781.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5782.  
  5783.    *   SSMA informational messages:
  5784.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Item name to show'.
  5785.    */
  5786.  
  5787.    [caption] nvarchar(max)  NOT NULL,
  5788.  
  5789.    /*
  5790.    *   SSMA warning messages:
  5791.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5792.  
  5793.    *   SSMA informational messages:
  5794.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Description'.
  5795.    */
  5796.  
  5797.    [info] nvarchar(max)  NULL,
  5798.  
  5799.    /*
  5800.    *   SSMA warning messages:
  5801.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5802.    */
  5803.  
  5804.    [lang] nchar(5) DEFAULT N''  NOT NULL
  5805. )
  5806. GO
  5807. BEGIN TRY
  5808.     EXEC sp_addextendedproperty
  5809.         N'MS_SSMA_SOURCE', N'dbo.profile_translation',
  5810.         N'SCHEMA', N'dbo',
  5811.         N'TABLE', N'profile_translation'
  5812. END TRY
  5813. BEGIN CATCH
  5814.     IF (@@TRANCOUNT > 0) ROLLBACK
  5815.     PRINT ERROR_MESSAGE()
  5816. END CATCH
  5817. GO
  5818. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'session'  AND sc.name=N'dbo'  AND type in (N'U'))
  5819. BEGIN
  5820.  
  5821.   DECLARE @drop_statement nvarchar(500)
  5822.  
  5823.   DECLARE drop_cursor CURSOR FOR
  5824.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5825.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5826.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5827.       WHERE fk.referenced_object_id =
  5828.           (
  5829.              SELECT so.object_id
  5830.              FROM sys.objects so JOIN sys.schemas sc
  5831.              ON so.schema_id = sc.schema_id
  5832.              WHERE so.name = N'session'  AND sc.name=N'dbo'  AND type in (N'U')
  5833.            )
  5834.  
  5835.   OPEN drop_cursor
  5836.  
  5837.   FETCH NEXT FROM drop_cursor
  5838.   INTO @drop_statement
  5839.  
  5840.   WHILE @@FETCH_STATUS = 0
  5841.   BEGIN
  5842.      EXEC (@drop_statement)
  5843.  
  5844.      FETCH NEXT FROM drop_cursor
  5845.      INTO @drop_statement
  5846.   END
  5847.  
  5848.   CLOSE drop_cursor
  5849.   DEALLOCATE drop_cursor
  5850.  
  5851.   DROP TABLE [dbo].[session]
  5852. END
  5853. GO
  5854.  
  5855. SET ANSI_NULLS ON
  5856. GO
  5857. SET QUOTED_IDENTIFIER ON
  5858. GO
  5859. CREATE TABLE
  5860. [dbo].[session]
  5861. (
  5862.  
  5863.    /*
  5864.    *   SSMA warning messages:
  5865.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5866.    */
  5867.  
  5868.    [id] nvarchar(128) DEFAULT N''  NOT NULL,
  5869.  
  5870.    /*
  5871.    *   SSMA warning messages:
  5872.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5873.  
  5874.    *   SSMA informational messages:
  5875.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Session information'.
  5876.    */
  5877.  
  5878.    [session_data] nvarchar(max)  NULL,
  5879.  
  5880.    /*
  5881.    *   SSMA warning messages:
  5882.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5883.  
  5884.    *   SSMA informational messages:
  5885.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Timestamp of generated time'.
  5886.    */
  5887.  
  5888.    [time] nvarchar(max)  NULL
  5889. )
  5890. GO
  5891. BEGIN TRY
  5892.     EXEC sp_addextendedproperty
  5893.         N'MS_SSMA_SOURCE', N'dbo.session',
  5894.         N'SCHEMA', N'dbo',
  5895.         N'TABLE', N'session'
  5896. END TRY
  5897. BEGIN CATCH
  5898.     IF (@@TRANCOUNT > 0) ROLLBACK
  5899.     PRINT ERROR_MESSAGE()
  5900. END CATCH
  5901. GO
  5902. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'skin_config'  AND sc.name=N'dbo'  AND type in (N'U'))
  5903. BEGIN
  5904.  
  5905.   DECLARE @drop_statement nvarchar(500)
  5906.  
  5907.   DECLARE drop_cursor CURSOR FOR
  5908.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  5909.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  5910.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  5911.       WHERE fk.referenced_object_id =
  5912.           (
  5913.              SELECT so.object_id
  5914.              FROM sys.objects so JOIN sys.schemas sc
  5915.              ON so.schema_id = sc.schema_id
  5916.              WHERE so.name = N'skin_config'  AND sc.name=N'dbo'  AND type in (N'U')
  5917.            )
  5918.  
  5919.   OPEN drop_cursor
  5920.  
  5921.   FETCH NEXT FROM drop_cursor
  5922.   INTO @drop_statement
  5923.  
  5924.   WHILE @@FETCH_STATUS = 0
  5925.   BEGIN
  5926.      EXEC (@drop_statement)
  5927.  
  5928.      FETCH NEXT FROM drop_cursor
  5929.      INTO @drop_statement
  5930.   END
  5931.  
  5932.   CLOSE drop_cursor
  5933.   DEALLOCATE drop_cursor
  5934.  
  5935.   DROP TABLE [dbo].[skin_config]
  5936. END
  5937. GO
  5938.  
  5939. SET ANSI_NULLS ON
  5940. GO
  5941. SET QUOTED_IDENTIFIER ON
  5942. GO
  5943. CREATE TABLE
  5944. [dbo].[skin_config]
  5945. (
  5946.  
  5947.    /*
  5948.    *   SSMA informational messages:
  5949.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  5950.    */
  5951.  
  5952.    [id] int IDENTITY(1, 1)  NOT NULL,
  5953.  
  5954.    /*
  5955.    *   SSMA warning messages:
  5956.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5957.  
  5958.    *   SSMA informational messages:
  5959.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Plugin name'.
  5960.    */
  5961.  
  5962.    [plugin] nvarchar(64) DEFAULT N''  NOT NULL,
  5963.  
  5964.    /*
  5965.    *   SSMA warning messages:
  5966.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5967.  
  5968.    *   SSMA informational messages:
  5969.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration name'.
  5970.    */
  5971.  
  5972.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  5973.  
  5974.    /*
  5975.    *   SSMA warning messages:
  5976.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  5977.  
  5978.    *   SSMA informational messages:
  5979.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration value'.
  5980.    */
  5981.  
  5982.    [value] nvarchar(max)  NULL,
  5983.    [created_at] datetime2(0)  NOT NULL,
  5984.    [updated_at] datetime2(0)  NOT NULL
  5985. )
  5986. GO
  5987. BEGIN TRY
  5988.     EXEC sp_addextendedproperty
  5989.         N'MS_SSMA_SOURCE', N'dbo.skin_config',
  5990.         N'SCHEMA', N'dbo',
  5991.         N'TABLE', N'skin_config'
  5992. END TRY
  5993. BEGIN CATCH
  5994.     IF (@@TRANCOUNT > 0) ROLLBACK
  5995.     PRINT ERROR_MESSAGE()
  5996. END CATCH
  5997. GO
  5998. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'sns_config'  AND sc.name=N'dbo'  AND type in (N'U'))
  5999. BEGIN
  6000.  
  6001.   DECLARE @drop_statement nvarchar(500)
  6002.  
  6003.   DECLARE drop_cursor CURSOR FOR
  6004.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  6005.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  6006.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  6007.       WHERE fk.referenced_object_id =
  6008.           (
  6009.              SELECT so.object_id
  6010.              FROM sys.objects so JOIN sys.schemas sc
  6011.              ON so.schema_id = sc.schema_id
  6012.              WHERE so.name = N'sns_config'  AND sc.name=N'dbo'  AND type in (N'U')
  6013.            )
  6014.  
  6015.   OPEN drop_cursor
  6016.  
  6017.   FETCH NEXT FROM drop_cursor
  6018.   INTO @drop_statement
  6019.  
  6020.   WHILE @@FETCH_STATUS = 0
  6021.   BEGIN
  6022.      EXEC (@drop_statement)
  6023.  
  6024.      FETCH NEXT FROM drop_cursor
  6025.      INTO @drop_statement
  6026.   END
  6027.  
  6028.   CLOSE drop_cursor
  6029.   DEALLOCATE drop_cursor
  6030.  
  6031.   DROP TABLE [dbo].[sns_config]
  6032. END
  6033. GO
  6034.  
  6035. SET ANSI_NULLS ON
  6036. GO
  6037. SET QUOTED_IDENTIFIER ON
  6038. GO
  6039. CREATE TABLE
  6040. [dbo].[sns_config]
  6041. (
  6042.  
  6043.    /*
  6044.    *   SSMA informational messages:
  6045.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  6046.    */
  6047.  
  6048.    [id] int IDENTITY(15, 1)  NOT NULL,
  6049.  
  6050.    /*
  6051.    *   SSMA warning messages:
  6052.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  6053.  
  6054.    *   SSMA informational messages:
  6055.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration name'.
  6056.    */
  6057.  
  6058.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  6059.  
  6060.    /*
  6061.    *   SSMA warning messages:
  6062.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  6063.  
  6064.    *   SSMA informational messages:
  6065.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Configuration value'.
  6066.    */
  6067.  
  6068.    [value] nvarchar(max)  NULL
  6069. )
  6070. GO
  6071. BEGIN TRY
  6072.     EXEC sp_addextendedproperty
  6073.         N'MS_SSMA_SOURCE', N'dbo.sns_config',
  6074.         N'SCHEMA', N'dbo',
  6075.         N'TABLE', N'sns_config'
  6076. END TRY
  6077. BEGIN CATCH
  6078.     IF (@@TRANCOUNT > 0) ROLLBACK
  6079.     PRINT ERROR_MESSAGE()
  6080. END CATCH
  6081. GO
  6082. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'sns_term'  AND sc.name=N'dbo'  AND type in (N'U'))
  6083. BEGIN
  6084.  
  6085.   DECLARE @drop_statement nvarchar(500)
  6086.  
  6087.   DECLARE drop_cursor CURSOR FOR
  6088.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  6089.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  6090.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  6091.       WHERE fk.referenced_object_id =
  6092.           (
  6093.              SELECT so.object_id
  6094.              FROM sys.objects so JOIN sys.schemas sc
  6095.              ON so.schema_id = sc.schema_id
  6096.              WHERE so.name = N'sns_term'  AND sc.name=N'dbo'  AND type in (N'U')
  6097.            )
  6098.  
  6099.   OPEN drop_cursor
  6100.  
  6101.   FETCH NEXT FROM drop_cursor
  6102.   INTO @drop_statement
  6103.  
  6104.   WHILE @@FETCH_STATUS = 0
  6105.   BEGIN
  6106.      EXEC (@drop_statement)
  6107.  
  6108.      FETCH NEXT FROM drop_cursor
  6109.      INTO @drop_statement
  6110.   END
  6111.  
  6112.   CLOSE drop_cursor
  6113.   DEALLOCATE drop_cursor
  6114.  
  6115.   DROP TABLE [dbo].[sns_term]
  6116. END
  6117. GO
  6118.  
  6119. SET ANSI_NULLS ON
  6120. GO
  6121. SET QUOTED_IDENTIFIER ON
  6122. GO
  6123. CREATE TABLE
  6124. [dbo].[sns_term]
  6125. (
  6126.  
  6127.    /*
  6128.    *   SSMA informational messages:
  6129.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  6130.    */
  6131.  
  6132.    [id] int IDENTITY(13, 1)  NOT NULL,
  6133.  
  6134.    /*
  6135.    *   SSMA warning messages:
  6136.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  6137.  
  6138.    *   SSMA informational messages:
  6139.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Term name'.
  6140.    */
  6141.  
  6142.    [name] nvarchar(64) DEFAULT N''  NOT NULL,
  6143.  
  6144.    /*
  6145.    *   SSMA warning messages:
  6146.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  6147.  
  6148.    *   SSMA informational messages:
  6149.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Application name'.
  6150.    */
  6151.  
  6152.    [application] nvarchar(32) DEFAULT N'pc_frontend'  NOT NULL
  6153. )
  6154. GO
  6155. BEGIN TRY
  6156.     EXEC sp_addextendedproperty
  6157.         N'MS_SSMA_SOURCE', N'dbo.sns_term',
  6158.         N'SCHEMA', N'dbo',
  6159.         N'TABLE', N'sns_term'
  6160. END TRY
  6161. BEGIN CATCH
  6162.     IF (@@TRANCOUNT > 0) ROLLBACK
  6163.     PRINT ERROR_MESSAGE()
  6164. END CATCH
  6165. GO
  6166. IF  EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'sns_term_translation'  AND sc.name=N'dbo'  AND type in (N'U'))
  6167. BEGIN
  6168.  
  6169.   DECLARE @drop_statement nvarchar(500)
  6170.  
  6171.   DECLARE drop_cursor CURSOR FOR
  6172.       SELECT 'alter table '+quotename(schema_name(ob.schema_id))+
  6173.       '.'+quotename(object_name(ob.object_id))+ ' drop constraint ' + quotename(fk.name)
  6174.       FROM sys.objects ob INNER JOIN sys.foreign_keys fk ON fk.parent_object_id = ob.object_id
  6175.       WHERE fk.referenced_object_id =
  6176.           (
  6177.              SELECT so.object_id
  6178.              FROM sys.objects so JOIN sys.schemas sc
  6179.              ON so.schema_id = sc.schema_id
  6180.              WHERE so.name = N'sns_term_translation'  AND sc.name=N'dbo'  AND type in (N'U')
  6181.            )
  6182.  
  6183.   OPEN drop_cursor
  6184.  
  6185.   FETCH NEXT FROM drop_cursor
  6186.   INTO @drop_statement
  6187.  
  6188.   WHILE @@FETCH_STATUS = 0
  6189.   BEGIN
  6190.      EXEC (@drop_statement)
  6191.  
  6192.      FETCH NEXT FROM drop_cursor
  6193.      INTO @drop_statement
  6194.   END
  6195.  
  6196.   CLOSE drop_cursor
  6197.   DEALLOCATE drop_cursor
  6198.  
  6199.   DROP TABLE [dbo].[sns_term_translation]
  6200. END
  6201. GO
  6202.  
  6203. SET ANSI_NULLS ON
  6204. GO
  6205. SET QUOTED_IDENTIFIER ON
  6206. GO
  6207. CREATE TABLE
  6208. [dbo].[sns_term_translation]
  6209. (
  6210.  
  6211.    /*
  6212.    *   SSMA informational messages:
  6213.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Serial number'.
  6214.    *   M2SS0052: string literal was converted to NUMERIC literal
  6215.    */
  6216.  
  6217.    [id] int DEFAULT 0  NOT NULL,
  6218.  
  6219.    /*
  6220.    *   SSMA warning messages:
  6221.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  6222.  
  6223.    *   SSMA informational messages:
  6224.    *   M2SS0003: The following SQL clause was ignored during conversion: COMMENT 'Term value'.
  6225.    */
  6226.  
  6227.    [value] nvarchar(max)  NULL,
  6228.  
  6229.    /*
  6230.    *   SSMA warning messages:
  6231.    *   M2SS0183: The following SQL clause was ignored during conversion: COLLATE utf8_unicode_ci.
  6232.    */
  6233.  
  6234.    [lang] nchar(5) DEFAULT N''  NOT NULL
  6235. )
  6236. GO
  6237. BEGIN TRY
  6238.     EXEC sp_addextendedproperty
  6239.         N'MS_SSMA_SOURCE', N'dbo.sns_term_translation',
  6240.         N'SCHEMA', N'dbo',
  6241.         N'TABLE', N'sns_term_translation'
  6242. END TRY
  6243. BEGIN CATCH
  6244.     IF (@@TRANCOUNT > 0) ROLLBACK
  6245.     PRINT ERROR_MESSAGE()
  6246. END CATCH
  6247. GO
  6248. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_activity_data_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6249. ALTER TABLE [dbo].[activity_data] DROP CONSTRAINT [PK_activity_data_id]
  6250.  GO
  6251.  
  6252.  
  6253.  
  6254. ALTER TABLE [dbo].[activity_data]
  6255.  ADD CONSTRAINT [PK_activity_data_id]
  6256.  PRIMARY KEY
  6257.    CLUSTERED ([id] ASC)
  6258.  
  6259. GO
  6260.  
  6261. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_activity_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6262. ALTER TABLE [dbo].[activity_image] DROP CONSTRAINT [PK_activity_image_id]
  6263.  GO
  6264.  
  6265.  
  6266.  
  6267. ALTER TABLE [dbo].[activity_image]
  6268.  ADD CONSTRAINT [PK_activity_image_id]
  6269.  PRIMARY KEY
  6270.    CLUSTERED ([id] ASC)
  6271.  
  6272. GO
  6273.  
  6274. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_admin_user_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6275. ALTER TABLE [dbo].[admin_user] DROP CONSTRAINT [PK_admin_user_id]
  6276.  GO
  6277.  
  6278.  
  6279.  
  6280. ALTER TABLE [dbo].[admin_user]
  6281.  ADD CONSTRAINT [PK_admin_user_id]
  6282.  PRIMARY KEY
  6283.    CLUSTERED ([id] ASC)
  6284.  
  6285. GO
  6286.  
  6287. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_album_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6288. ALTER TABLE [dbo].[album] DROP CONSTRAINT [PK_album_id]
  6289.  GO
  6290.  
  6291.  
  6292.  
  6293. ALTER TABLE [dbo].[album]
  6294.  ADD CONSTRAINT [PK_album_id]
  6295.  PRIMARY KEY
  6296.    CLUSTERED ([id] ASC)
  6297.  
  6298. GO
  6299.  
  6300. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_album_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6301. ALTER TABLE [dbo].[album_image] DROP CONSTRAINT [PK_album_image_id]
  6302.  GO
  6303.  
  6304.  
  6305.  
  6306. ALTER TABLE [dbo].[album_image]
  6307.  ADD CONSTRAINT [PK_album_image_id]
  6308.  PRIMARY KEY
  6309.    CLUSTERED ([id] ASC)
  6310.  
  6311. GO
  6312.  
  6313. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_application_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6314. ALTER TABLE [dbo].[application] DROP CONSTRAINT [PK_application_id]
  6315.  GO
  6316.  
  6317.  
  6318.  
  6319. ALTER TABLE [dbo].[application]
  6320.  ADD CONSTRAINT [PK_application_id]
  6321.  PRIMARY KEY
  6322.    CLUSTERED ([id] ASC)
  6323.  
  6324. GO
  6325.  
  6326. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_application_invite_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6327. ALTER TABLE [dbo].[application_invite] DROP CONSTRAINT [PK_application_invite_id]
  6328.  GO
  6329.  
  6330.  
  6331.  
  6332. ALTER TABLE [dbo].[application_invite]
  6333.  ADD CONSTRAINT [PK_application_invite_id]
  6334.  PRIMARY KEY
  6335.    CLUSTERED ([id] ASC)
  6336.  
  6337. GO
  6338.  
  6339. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_application_lifecycle_event_queue_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6340. ALTER TABLE [dbo].[application_lifecycle_event_queue] DROP CONSTRAINT [PK_application_lifecycle_event_queue_id]
  6341.  GO
  6342.  
  6343.  
  6344.  
  6345. ALTER TABLE [dbo].[application_lifecycle_event_queue]
  6346.  ADD CONSTRAINT [PK_application_lifecycle_event_queue_id]
  6347.  PRIMARY KEY
  6348.    CLUSTERED ([id] ASC)
  6349.  
  6350. GO
  6351.  
  6352. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_application_persistent_data_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6353. ALTER TABLE [dbo].[application_persistent_data] DROP CONSTRAINT [PK_application_persistent_data_id]
  6354.  GO
  6355.  
  6356.  
  6357.  
  6358. ALTER TABLE [dbo].[application_persistent_data]
  6359.  ADD CONSTRAINT [PK_application_persistent_data_id]
  6360.  PRIMARY KEY
  6361.    CLUSTERED ([id] ASC)
  6362.  
  6363. GO
  6364.  
  6365. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_application_translation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6366. ALTER TABLE [dbo].[application_translation] DROP CONSTRAINT [PK_application_translation_id]
  6367.  GO
  6368.  
  6369.  
  6370.  
  6371. ALTER TABLE [dbo].[application_translation]
  6372.  ADD CONSTRAINT [PK_application_translation_id]
  6373.  PRIMARY KEY
  6374.    CLUSTERED ([id] ASC, [lang] ASC)
  6375.  
  6376. GO
  6377.  
  6378. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_ashiato_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6379. ALTER TABLE [dbo].[ashiato] DROP CONSTRAINT [PK_ashiato_id]
  6380.  GO
  6381.  
  6382.  
  6383.  
  6384. ALTER TABLE [dbo].[ashiato]
  6385.  ADD CONSTRAINT [PK_ashiato_id]
  6386.  PRIMARY KEY
  6387.    CLUSTERED ([id] ASC)
  6388.  
  6389. GO
  6390.  
  6391. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_banner_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6392. ALTER TABLE [dbo].[banner] DROP CONSTRAINT [PK_banner_id]
  6393.  GO
  6394.  
  6395.  
  6396.  
  6397. ALTER TABLE [dbo].[banner]
  6398.  ADD CONSTRAINT [PK_banner_id]
  6399.  PRIMARY KEY
  6400.    CLUSTERED ([id] ASC)
  6401.  
  6402. GO
  6403.  
  6404. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_banner_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6405. ALTER TABLE [dbo].[banner_image] DROP CONSTRAINT [PK_banner_image_id]
  6406.  GO
  6407.  
  6408.  
  6409.  
  6410. ALTER TABLE [dbo].[banner_image]
  6411.  ADD CONSTRAINT [PK_banner_image_id]
  6412.  PRIMARY KEY
  6413.    CLUSTERED ([id] ASC)
  6414.  
  6415. GO
  6416.  
  6417. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_banner_translation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6418. ALTER TABLE [dbo].[banner_translation] DROP CONSTRAINT [PK_banner_translation_id]
  6419.  GO
  6420.  
  6421.  
  6422.  
  6423. ALTER TABLE [dbo].[banner_translation]
  6424.  ADD CONSTRAINT [PK_banner_translation_id]
  6425.  PRIMARY KEY
  6426.    CLUSTERED ([id] ASC, [lang] ASC)
  6427.  
  6428. GO
  6429.  
  6430. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_banner_use_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6431. ALTER TABLE [dbo].[banner_use_image] DROP CONSTRAINT [PK_banner_use_image_id]
  6432.  GO
  6433.  
  6434.  
  6435.  
  6436. ALTER TABLE [dbo].[banner_use_image]
  6437.  ADD CONSTRAINT [PK_banner_use_image_id]
  6438.  PRIMARY KEY
  6439.    CLUSTERED ([id] ASC)
  6440.  
  6441. GO
  6442.  
  6443. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_blacklist_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6444. ALTER TABLE [dbo].[blacklist] DROP CONSTRAINT [PK_blacklist_id]
  6445.  GO
  6446.  
  6447.  
  6448.  
  6449. ALTER TABLE [dbo].[blacklist]
  6450.  ADD CONSTRAINT [PK_blacklist_id]
  6451.  PRIMARY KEY
  6452.    CLUSTERED ([id] ASC)
  6453.  
  6454. GO
  6455.  
  6456. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_blog_rss_cache_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6457. ALTER TABLE [dbo].[blog_rss_cache] DROP CONSTRAINT [PK_blog_rss_cache_id]
  6458.  GO
  6459.  
  6460.  
  6461.  
  6462. ALTER TABLE [dbo].[blog_rss_cache]
  6463.  ADD CONSTRAINT [PK_blog_rss_cache_id]
  6464.  PRIMARY KEY
  6465.    CLUSTERED ([id] ASC)
  6466.  
  6467. GO
  6468.  
  6469. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6470. ALTER TABLE [dbo].[community] DROP CONSTRAINT [PK_community_id]
  6471.  GO
  6472.  
  6473.  
  6474.  
  6475. ALTER TABLE [dbo].[community]
  6476.  ADD CONSTRAINT [PK_community_id]
  6477.  PRIMARY KEY
  6478.    CLUSTERED ([id] ASC)
  6479.  
  6480. GO
  6481.  
  6482. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_category_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6483. ALTER TABLE [dbo].[community_category] DROP CONSTRAINT [PK_community_category_id]
  6484.  GO
  6485.  
  6486.  
  6487.  
  6488. ALTER TABLE [dbo].[community_category]
  6489.  ADD CONSTRAINT [PK_community_category_id]
  6490.  PRIMARY KEY
  6491.    CLUSTERED ([id] ASC)
  6492.  
  6493. GO
  6494.  
  6495. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_config_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6496. ALTER TABLE [dbo].[community_config] DROP CONSTRAINT [PK_community_config_id]
  6497.  GO
  6498.  
  6499.  
  6500.  
  6501. ALTER TABLE [dbo].[community_config]
  6502.  ADD CONSTRAINT [PK_community_config_id]
  6503.  PRIMARY KEY
  6504.    CLUSTERED ([id] ASC)
  6505.  
  6506. GO
  6507.  
  6508. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_event_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6509. ALTER TABLE [dbo].[community_event] DROP CONSTRAINT [PK_community_event_id]
  6510.  GO
  6511.  
  6512.  
  6513.  
  6514. ALTER TABLE [dbo].[community_event]
  6515.  ADD CONSTRAINT [PK_community_event_id]
  6516.  PRIMARY KEY
  6517.    CLUSTERED ([id] ASC)
  6518.  
  6519. GO
  6520.  
  6521. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_event_comment_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6522. ALTER TABLE [dbo].[community_event_comment] DROP CONSTRAINT [PK_community_event_comment_id]
  6523.  GO
  6524.  
  6525.  
  6526.  
  6527. ALTER TABLE [dbo].[community_event_comment]
  6528.  ADD CONSTRAINT [PK_community_event_comment_id]
  6529.  PRIMARY KEY
  6530.    CLUSTERED ([id] ASC)
  6531.  
  6532. GO
  6533.  
  6534. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_event_comment_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6535. ALTER TABLE [dbo].[community_event_comment_image] DROP CONSTRAINT [PK_community_event_comment_image_id]
  6536.  GO
  6537.  
  6538.  
  6539.  
  6540. ALTER TABLE [dbo].[community_event_comment_image]
  6541.  ADD CONSTRAINT [PK_community_event_comment_image_id]
  6542.  PRIMARY KEY
  6543.    CLUSTERED ([id] ASC)
  6544.  
  6545. GO
  6546.  
  6547. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_event_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6548. ALTER TABLE [dbo].[community_event_image] DROP CONSTRAINT [PK_community_event_image_id]
  6549.  GO
  6550.  
  6551.  
  6552.  
  6553. ALTER TABLE [dbo].[community_event_image]
  6554.  ADD CONSTRAINT [PK_community_event_image_id]
  6555.  PRIMARY KEY
  6556.    CLUSTERED ([id] ASC)
  6557.  
  6558. GO
  6559.  
  6560. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_event_member_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6561. ALTER TABLE [dbo].[community_event_member] DROP CONSTRAINT [PK_community_event_member_id]
  6562.  GO
  6563.  
  6564.  
  6565.  
  6566. ALTER TABLE [dbo].[community_event_member]
  6567.  ADD CONSTRAINT [PK_community_event_member_id]
  6568.  PRIMARY KEY
  6569.    CLUSTERED ([id] ASC)
  6570.  
  6571. GO
  6572.  
  6573. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_member_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6574. ALTER TABLE [dbo].[community_member] DROP CONSTRAINT [PK_community_member_id]
  6575.  GO
  6576.  
  6577.  
  6578.  
  6579. ALTER TABLE [dbo].[community_member]
  6580.  ADD CONSTRAINT [PK_community_member_id]
  6581.  PRIMARY KEY
  6582.    CLUSTERED ([id] ASC)
  6583.  
  6584. GO
  6585.  
  6586. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_member_position_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6587. ALTER TABLE [dbo].[community_member_position] DROP CONSTRAINT [PK_community_member_position_id]
  6588.  GO
  6589.  
  6590.  
  6591.  
  6592. ALTER TABLE [dbo].[community_member_position]
  6593.  ADD CONSTRAINT [PK_community_member_position_id]
  6594.  PRIMARY KEY
  6595.    CLUSTERED ([id] ASC)
  6596.  
  6597. GO
  6598.  
  6599. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_topic_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6600. ALTER TABLE [dbo].[community_topic] DROP CONSTRAINT [PK_community_topic_id]
  6601.  GO
  6602.  
  6603.  
  6604.  
  6605. ALTER TABLE [dbo].[community_topic]
  6606.  ADD CONSTRAINT [PK_community_topic_id]
  6607.  PRIMARY KEY
  6608.    CLUSTERED ([id] ASC)
  6609.  
  6610. GO
  6611.  
  6612. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_topic_comment_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6613. ALTER TABLE [dbo].[community_topic_comment] DROP CONSTRAINT [PK_community_topic_comment_id]
  6614.  GO
  6615.  
  6616.  
  6617.  
  6618. ALTER TABLE [dbo].[community_topic_comment]
  6619.  ADD CONSTRAINT [PK_community_topic_comment_id]
  6620.  PRIMARY KEY
  6621.    CLUSTERED ([id] ASC)
  6622.  
  6623. GO
  6624.  
  6625. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_topic_comment_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6626. ALTER TABLE [dbo].[community_topic_comment_image] DROP CONSTRAINT [PK_community_topic_comment_image_id]
  6627.  GO
  6628.  
  6629.  
  6630.  
  6631. ALTER TABLE [dbo].[community_topic_comment_image]
  6632.  ADD CONSTRAINT [PK_community_topic_comment_image_id]
  6633.  PRIMARY KEY
  6634.    CLUSTERED ([id] ASC)
  6635.  
  6636. GO
  6637.  
  6638. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_community_topic_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6639. ALTER TABLE [dbo].[community_topic_image] DROP CONSTRAINT [PK_community_topic_image_id]
  6640.  GO
  6641.  
  6642.  
  6643.  
  6644. ALTER TABLE [dbo].[community_topic_image]
  6645.  ADD CONSTRAINT [PK_community_topic_image_id]
  6646.  PRIMARY KEY
  6647.    CLUSTERED ([id] ASC)
  6648.  
  6649. GO
  6650.  
  6651. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_deleted_message_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6652. ALTER TABLE [dbo].[deleted_message] DROP CONSTRAINT [PK_deleted_message_id]
  6653.  GO
  6654.  
  6655.  
  6656.  
  6657. ALTER TABLE [dbo].[deleted_message]
  6658.  ADD CONSTRAINT [PK_deleted_message_id]
  6659.  PRIMARY KEY
  6660.    CLUSTERED ([id] ASC)
  6661.  
  6662. GO
  6663.  
  6664. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_diary_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6665. ALTER TABLE [dbo].[diary] DROP CONSTRAINT [PK_diary_id]
  6666.  GO
  6667.  
  6668.  
  6669.  
  6670. ALTER TABLE [dbo].[diary]
  6671.  ADD CONSTRAINT [PK_diary_id]
  6672.  PRIMARY KEY
  6673.    CLUSTERED ([id] ASC)
  6674.  
  6675. GO
  6676.  
  6677. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_diary_comment_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6678. ALTER TABLE [dbo].[diary_comment] DROP CONSTRAINT [PK_diary_comment_id]
  6679.  GO
  6680.  
  6681.  
  6682.  
  6683. ALTER TABLE [dbo].[diary_comment]
  6684.  ADD CONSTRAINT [PK_diary_comment_id]
  6685.  PRIMARY KEY
  6686.    CLUSTERED ([id] ASC)
  6687.  
  6688. GO
  6689.  
  6690. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_diary_comment_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6691. ALTER TABLE [dbo].[diary_comment_image] DROP CONSTRAINT [PK_diary_comment_image_id]
  6692.  GO
  6693.  
  6694.  
  6695.  
  6696. ALTER TABLE [dbo].[diary_comment_image]
  6697.  ADD CONSTRAINT [PK_diary_comment_image_id]
  6698.  PRIMARY KEY
  6699.    CLUSTERED ([id] ASC)
  6700.  
  6701. GO
  6702.  
  6703. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_diary_comment_unread_diary_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6704. ALTER TABLE [dbo].[diary_comment_unread] DROP CONSTRAINT [PK_diary_comment_unread_diary_id]
  6705.  GO
  6706.  
  6707.  
  6708.  
  6709. ALTER TABLE [dbo].[diary_comment_unread]
  6710.  ADD CONSTRAINT [PK_diary_comment_unread_diary_id]
  6711.  PRIMARY KEY
  6712.    CLUSTERED ([diary_id] ASC)
  6713.  
  6714. GO
  6715.  
  6716. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_diary_comment_update_diary_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6717. ALTER TABLE [dbo].[diary_comment_update] DROP CONSTRAINT [PK_diary_comment_update_diary_id]
  6718.  GO
  6719.  
  6720.  
  6721.  
  6722. ALTER TABLE [dbo].[diary_comment_update]
  6723.  ADD CONSTRAINT [PK_diary_comment_update_diary_id]
  6724.  PRIMARY KEY
  6725.    CLUSTERED ([diary_id] ASC, [member_id] ASC)
  6726.  
  6727. GO
  6728.  
  6729. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_diary_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6730. ALTER TABLE [dbo].[diary_image] DROP CONSTRAINT [PK_diary_image_id]
  6731.  GO
  6732.  
  6733.  
  6734.  
  6735. ALTER TABLE [dbo].[diary_image]
  6736.  ADD CONSTRAINT [PK_diary_image_id]
  6737.  PRIMARY KEY
  6738.    CLUSTERED ([id] ASC)
  6739.  
  6740. GO
  6741.  
  6742. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_favorite_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6743. ALTER TABLE [dbo].[favorite] DROP CONSTRAINT [PK_favorite_id]
  6744.  GO
  6745.  
  6746.  
  6747.  
  6748. ALTER TABLE [dbo].[favorite]
  6749.  ADD CONSTRAINT [PK_favorite_id]
  6750.  PRIMARY KEY
  6751.    CLUSTERED ([id] ASC)
  6752.  
  6753. GO
  6754.  
  6755. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_file_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6756. ALTER TABLE [dbo].[file] DROP CONSTRAINT [PK_file_id]
  6757.  GO
  6758.  
  6759.  
  6760.  
  6761. ALTER TABLE [dbo].[file]
  6762.  ADD CONSTRAINT [PK_file_id]
  6763.  PRIMARY KEY
  6764.    CLUSTERED ([id] ASC)
  6765.  
  6766. GO
  6767.  
  6768. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_file_bin_file_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6769. ALTER TABLE [dbo].[file_bin] DROP CONSTRAINT [PK_file_bin_file_id]
  6770.  GO
  6771.  
  6772.  
  6773.  
  6774. ALTER TABLE [dbo].[file_bin]
  6775.  ADD CONSTRAINT [PK_file_bin_file_id]
  6776.  PRIMARY KEY
  6777.    CLUSTERED ([file_id] ASC)
  6778.  
  6779. GO
  6780.  
  6781. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_gadget_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6782. ALTER TABLE [dbo].[gadget] DROP CONSTRAINT [PK_gadget_id]
  6783.  GO
  6784.  
  6785.  
  6786.  
  6787. ALTER TABLE [dbo].[gadget]
  6788.  ADD CONSTRAINT [PK_gadget_id]
  6789.  PRIMARY KEY
  6790.    CLUSTERED ([id] ASC)
  6791.  
  6792. GO
  6793.  
  6794. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_gadget_config_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6795. ALTER TABLE [dbo].[gadget_config] DROP CONSTRAINT [PK_gadget_config_id]
  6796.  GO
  6797.  
  6798.  
  6799.  
  6800. ALTER TABLE [dbo].[gadget_config]
  6801.  ADD CONSTRAINT [PK_gadget_config_id]
  6802.  PRIMARY KEY
  6803.    CLUSTERED ([id] ASC)
  6804.  
  6805. GO
  6806.  
  6807. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_member_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6808. ALTER TABLE [dbo].[member] DROP CONSTRAINT [PK_member_id]
  6809.  GO
  6810.  
  6811.  
  6812.  
  6813. ALTER TABLE [dbo].[member]
  6814.  ADD CONSTRAINT [PK_member_id]
  6815.  PRIMARY KEY
  6816.    CLUSTERED ([id] ASC)
  6817.  
  6818. GO
  6819.  
  6820. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_member_application_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6821. ALTER TABLE [dbo].[member_application] DROP CONSTRAINT [PK_member_application_id]
  6822.  GO
  6823.  
  6824.  
  6825.  
  6826. ALTER TABLE [dbo].[member_application]
  6827.  ADD CONSTRAINT [PK_member_application_id]
  6828.  PRIMARY KEY
  6829.    CLUSTERED ([id] ASC)
  6830.  
  6831. GO
  6832.  
  6833. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_member_application_setting_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6834. ALTER TABLE [dbo].[member_application_setting] DROP CONSTRAINT [PK_member_application_setting_id]
  6835.  GO
  6836.  
  6837.  
  6838.  
  6839. ALTER TABLE [dbo].[member_application_setting]
  6840.  ADD CONSTRAINT [PK_member_application_setting_id]
  6841.  PRIMARY KEY
  6842.    CLUSTERED ([id] ASC)
  6843.  
  6844. GO
  6845.  
  6846. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_member_config_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6847. ALTER TABLE [dbo].[member_config] DROP CONSTRAINT [PK_member_config_id]
  6848.  GO
  6849.  
  6850.  
  6851.  
  6852. ALTER TABLE [dbo].[member_config]
  6853.  ADD CONSTRAINT [PK_member_config_id]
  6854.  PRIMARY KEY
  6855.    CLUSTERED ([id] ASC)
  6856.  
  6857. GO
  6858.  
  6859. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_member_image_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6860. ALTER TABLE [dbo].[member_image] DROP CONSTRAINT [PK_member_image_id]
  6861.  GO
  6862.  
  6863.  
  6864.  
  6865. ALTER TABLE [dbo].[member_image]
  6866.  ADD CONSTRAINT [PK_member_image_id]
  6867.  PRIMARY KEY
  6868.    CLUSTERED ([id] ASC)
  6869.  
  6870. GO
  6871.  
  6872. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_member_profile_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6873. ALTER TABLE [dbo].[member_profile] DROP CONSTRAINT [PK_member_profile_id]
  6874.  GO
  6875.  
  6876.  
  6877.  
  6878. ALTER TABLE [dbo].[member_profile]
  6879.  ADD CONSTRAINT [PK_member_profile_id]
  6880.  PRIMARY KEY
  6881.    CLUSTERED ([id] ASC)
  6882.  
  6883. GO
  6884.  
  6885. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_member_relationship_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6886. ALTER TABLE [dbo].[member_relationship] DROP CONSTRAINT [PK_member_relationship_id]
  6887.  GO
  6888.  
  6889.  
  6890.  
  6891. ALTER TABLE [dbo].[member_relationship]
  6892.  ADD CONSTRAINT [PK_member_relationship_id]
  6893.  PRIMARY KEY
  6894.    CLUSTERED ([id] ASC)
  6895.  
  6896. GO
  6897.  
  6898. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_message_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6899. ALTER TABLE [dbo].[message] DROP CONSTRAINT [PK_message_id]
  6900.  GO
  6901.  
  6902.  
  6903.  
  6904. ALTER TABLE [dbo].[message]
  6905.  ADD CONSTRAINT [PK_message_id]
  6906.  PRIMARY KEY
  6907.    CLUSTERED ([id] ASC)
  6908.  
  6909. GO
  6910.  
  6911. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_message_file_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6912. ALTER TABLE [dbo].[message_file] DROP CONSTRAINT [PK_message_file_id]
  6913.  GO
  6914.  
  6915.  
  6916.  
  6917. ALTER TABLE [dbo].[message_file]
  6918.  ADD CONSTRAINT [PK_message_file_id]
  6919.  PRIMARY KEY
  6920.    CLUSTERED ([id] ASC)
  6921.  
  6922. GO
  6923.  
  6924. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_message_send_list_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6925. ALTER TABLE [dbo].[message_send_list] DROP CONSTRAINT [PK_message_send_list_id]
  6926.  GO
  6927.  
  6928.  
  6929.  
  6930. ALTER TABLE [dbo].[message_send_list]
  6931.  ADD CONSTRAINT [PK_message_send_list_id]
  6932.  PRIMARY KEY
  6933.    CLUSTERED ([id] ASC)
  6934.  
  6935. GO
  6936.  
  6937. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_message_type_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6938. ALTER TABLE [dbo].[message_type] DROP CONSTRAINT [PK_message_type_id]
  6939.  GO
  6940.  
  6941.  
  6942.  
  6943. ALTER TABLE [dbo].[message_type]
  6944.  ADD CONSTRAINT [PK_message_type_id]
  6945.  PRIMARY KEY
  6946.    CLUSTERED ([id] ASC)
  6947.  
  6948. GO
  6949.  
  6950. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_message_type_translation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6951. ALTER TABLE [dbo].[message_type_translation] DROP CONSTRAINT [PK_message_type_translation_id]
  6952.  GO
  6953.  
  6954.  
  6955.  
  6956. ALTER TABLE [dbo].[message_type_translation]
  6957.  ADD CONSTRAINT [PK_message_type_translation_id]
  6958.  PRIMARY KEY
  6959.    CLUSTERED ([id] ASC, [lang] ASC)
  6960.  
  6961. GO
  6962.  
  6963. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_navigation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6964. ALTER TABLE [dbo].[navigation] DROP CONSTRAINT [PK_navigation_id]
  6965.  GO
  6966.  
  6967.  
  6968.  
  6969. ALTER TABLE [dbo].[navigation]
  6970.  ADD CONSTRAINT [PK_navigation_id]
  6971.  PRIMARY KEY
  6972.    CLUSTERED ([id] ASC)
  6973.  
  6974. GO
  6975.  
  6976. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_navigation_translation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6977. ALTER TABLE [dbo].[navigation_translation] DROP CONSTRAINT [PK_navigation_translation_id]
  6978.  GO
  6979.  
  6980.  
  6981.  
  6982. ALTER TABLE [dbo].[navigation_translation]
  6983.  ADD CONSTRAINT [PK_navigation_translation_id]
  6984.  PRIMARY KEY
  6985.    CLUSTERED ([id] ASC, [lang] ASC)
  6986.  
  6987. GO
  6988.  
  6989. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_notification_mail_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  6990. ALTER TABLE [dbo].[notification_mail] DROP CONSTRAINT [PK_notification_mail_id]
  6991.  GO
  6992.  
  6993.  
  6994.  
  6995. ALTER TABLE [dbo].[notification_mail]
  6996.  ADD CONSTRAINT [PK_notification_mail_id]
  6997.  PRIMARY KEY
  6998.    CLUSTERED ([id] ASC)
  6999.  
  7000. GO
  7001.  
  7002. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_notification_mail_translation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7003. ALTER TABLE [dbo].[notification_mail_translation] DROP CONSTRAINT [PK_notification_mail_translation_id]
  7004.  GO
  7005.  
  7006.  
  7007.  
  7008. ALTER TABLE [dbo].[notification_mail_translation]
  7009.  ADD CONSTRAINT [PK_notification_mail_translation_id]
  7010.  PRIMARY KEY
  7011.    CLUSTERED ([id] ASC, [lang] ASC)
  7012.  
  7013. GO
  7014.  
  7015. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_o_auth_admin_token_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7016. ALTER TABLE [dbo].[o_auth_admin_token] DROP CONSTRAINT [PK_o_auth_admin_token_id]
  7017.  GO
  7018.  
  7019.  
  7020.  
  7021. ALTER TABLE [dbo].[o_auth_admin_token]
  7022.  ADD CONSTRAINT [PK_o_auth_admin_token_id]
  7023.  PRIMARY KEY
  7024.    CLUSTERED ([id] ASC)
  7025.  
  7026. GO
  7027.  
  7028. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_o_auth_member_token_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7029. ALTER TABLE [dbo].[o_auth_member_token] DROP CONSTRAINT [PK_o_auth_member_token_id]
  7030.  GO
  7031.  
  7032.  
  7033.  
  7034. ALTER TABLE [dbo].[o_auth_member_token]
  7035.  ADD CONSTRAINT [PK_o_auth_member_token_id]
  7036.  PRIMARY KEY
  7037.    CLUSTERED ([id] ASC)
  7038.  
  7039. GO
  7040.  
  7041. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_oauth_consumer_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7042. ALTER TABLE [dbo].[oauth_consumer] DROP CONSTRAINT [PK_oauth_consumer_id]
  7043.  GO
  7044.  
  7045.  
  7046.  
  7047. ALTER TABLE [dbo].[oauth_consumer]
  7048.  ADD CONSTRAINT [PK_oauth_consumer_id]
  7049.  PRIMARY KEY
  7050.    CLUSTERED ([id] ASC)
  7051.  
  7052. GO
  7053.  
  7054. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_openid_trust_log_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7055. ALTER TABLE [dbo].[openid_trust_log] DROP CONSTRAINT [PK_openid_trust_log_id]
  7056.  GO
  7057.  
  7058.  
  7059.  
  7060. ALTER TABLE [dbo].[openid_trust_log]
  7061.  ADD CONSTRAINT [PK_openid_trust_log_id]
  7062.  PRIMARY KEY
  7063.    CLUSTERED ([id] ASC)
  7064.  
  7065. GO
  7066.  
  7067. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_plugin_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7068. ALTER TABLE [dbo].[plugin] DROP CONSTRAINT [PK_plugin_id]
  7069.  GO
  7070.  
  7071.  
  7072.  
  7073. ALTER TABLE [dbo].[plugin]
  7074.  ADD CONSTRAINT [PK_plugin_id]
  7075.  PRIMARY KEY
  7076.    CLUSTERED ([id] ASC)
  7077.  
  7078. GO
  7079.  
  7080. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_profile_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7081. ALTER TABLE [dbo].[profile] DROP CONSTRAINT [PK_profile_id]
  7082.  GO
  7083.  
  7084.  
  7085.  
  7086. ALTER TABLE [dbo].[profile]
  7087.  ADD CONSTRAINT [PK_profile_id]
  7088.  PRIMARY KEY
  7089.    CLUSTERED ([id] ASC)
  7090.  
  7091. GO
  7092.  
  7093. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_profile_option_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7094. ALTER TABLE [dbo].[profile_option] DROP CONSTRAINT [PK_profile_option_id]
  7095.  GO
  7096.  
  7097.  
  7098.  
  7099. ALTER TABLE [dbo].[profile_option]
  7100.  ADD CONSTRAINT [PK_profile_option_id]
  7101.  PRIMARY KEY
  7102.    CLUSTERED ([id] ASC)
  7103.  
  7104. GO
  7105.  
  7106. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_profile_option_translation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7107. ALTER TABLE [dbo].[profile_option_translation] DROP CONSTRAINT [PK_profile_option_translation_id]
  7108.  GO
  7109.  
  7110.  
  7111.  
  7112. ALTER TABLE [dbo].[profile_option_translation]
  7113.  ADD CONSTRAINT [PK_profile_option_translation_id]
  7114.  PRIMARY KEY
  7115.    CLUSTERED ([id] ASC, [lang] ASC)
  7116.  
  7117. GO
  7118.  
  7119. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_profile_translation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7120. ALTER TABLE [dbo].[profile_translation] DROP CONSTRAINT [PK_profile_translation_id]
  7121.  GO
  7122.  
  7123.  
  7124.  
  7125. ALTER TABLE [dbo].[profile_translation]
  7126.  ADD CONSTRAINT [PK_profile_translation_id]
  7127.  PRIMARY KEY
  7128.    CLUSTERED ([id] ASC, [lang] ASC)
  7129.  
  7130. GO
  7131.  
  7132. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_session_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7133. ALTER TABLE [dbo].[session] DROP CONSTRAINT [PK_session_id]
  7134.  GO
  7135.  
  7136.  
  7137.  
  7138. ALTER TABLE [dbo].[session]
  7139.  ADD CONSTRAINT [PK_session_id]
  7140.  PRIMARY KEY
  7141.    CLUSTERED ([id] ASC)
  7142.  
  7143. GO
  7144.  
  7145. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_skin_config_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7146. ALTER TABLE [dbo].[skin_config] DROP CONSTRAINT [PK_skin_config_id]
  7147.  GO
  7148.  
  7149.  
  7150.  
  7151. ALTER TABLE [dbo].[skin_config]
  7152.  ADD CONSTRAINT [PK_skin_config_id]
  7153.  PRIMARY KEY
  7154.    CLUSTERED ([id] ASC)
  7155.  
  7156. GO
  7157.  
  7158. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_sns_config_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7159. ALTER TABLE [dbo].[sns_config] DROP CONSTRAINT [PK_sns_config_id]
  7160.  GO
  7161.  
  7162.  
  7163.  
  7164. ALTER TABLE [dbo].[sns_config]
  7165.  ADD CONSTRAINT [PK_sns_config_id]
  7166.  PRIMARY KEY
  7167.    CLUSTERED ([id] ASC)
  7168.  
  7169. GO
  7170.  
  7171. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_sns_term_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7172. ALTER TABLE [dbo].[sns_term] DROP CONSTRAINT [PK_sns_term_id]
  7173.  GO
  7174.  
  7175.  
  7176.  
  7177. ALTER TABLE [dbo].[sns_term]
  7178.  ADD CONSTRAINT [PK_sns_term_id]
  7179.  PRIMARY KEY
  7180.    CLUSTERED ([id] ASC)
  7181.  
  7182. GO
  7183.  
  7184. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'PK_sns_term_translation_id'  AND sc.name=N'dbo'  AND type in (N'PK'))
  7185. ALTER TABLE [dbo].[sns_term_translation] DROP CONSTRAINT [PK_sns_term_translation_id]
  7186.  GO
  7187.  
  7188.  
  7189.  
  7190. ALTER TABLE [dbo].[sns_term_translation]
  7191.  ADD CONSTRAINT [PK_sns_term_translation_id]
  7192.  PRIMARY KEY
  7193.    CLUSTERED ([id] ASC, [lang] ASC)
  7194.  
  7195. GO
  7196.  
  7197. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'admin_user$username_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7198. ALTER TABLE [dbo].[admin_user] DROP CONSTRAINT [admin_user$username_UNIQUE_idx]
  7199.  GO
  7200.  
  7201.  
  7202.  
  7203. ALTER TABLE [dbo].[admin_user]
  7204.  ADD CONSTRAINT [admin_user$username_UNIQUE_idx]
  7205.  UNIQUE
  7206.    NONCLUSTERED ([username] ASC)
  7207.  
  7208. GO
  7209.  
  7210. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_persistent_data$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7211. ALTER TABLE [dbo].[application_persistent_data] DROP CONSTRAINT [application_persistent_data$name_UNIQUE_idx]
  7212.  GO
  7213.  
  7214.  
  7215.  
  7216. ALTER TABLE [dbo].[application_persistent_data]
  7217.  ADD CONSTRAINT [application_persistent_data$name_UNIQUE_idx]
  7218.  UNIQUE
  7219.    NONCLUSTERED ([application_id] ASC, [member_id] ASC, [name] ASC)
  7220.  
  7221. GO
  7222.  
  7223. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7224. ALTER TABLE [dbo].[banner] DROP CONSTRAINT [banner$name_UNIQUE_idx]
  7225.  GO
  7226.  
  7227.  
  7228.  
  7229. ALTER TABLE [dbo].[banner]
  7230.  ADD CONSTRAINT [banner$name_UNIQUE_idx]
  7231.  UNIQUE
  7232.    NONCLUSTERED ([name] ASC)
  7233.  
  7234. GO
  7235.  
  7236. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'blacklist$uid_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7237. ALTER TABLE [dbo].[blacklist] DROP CONSTRAINT [blacklist$uid_UNIQUE_idx]
  7238.  GO
  7239.  
  7240.  
  7241.  
  7242. ALTER TABLE [dbo].[blacklist]
  7243.  ADD CONSTRAINT [blacklist$uid_UNIQUE_idx]
  7244.  UNIQUE
  7245.    NONCLUSTERED ([uid] ASC)
  7246.  
  7247. GO
  7248.  
  7249. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7250. ALTER TABLE [dbo].[community] DROP CONSTRAINT [community$name_UNIQUE_idx]
  7251.  GO
  7252.  
  7253.  
  7254.  
  7255. ALTER TABLE [dbo].[community]
  7256.  ADD CONSTRAINT [community$name_UNIQUE_idx]
  7257.  UNIQUE
  7258.    NONCLUSTERED ([name] ASC)
  7259.  
  7260. GO
  7261.  
  7262. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_comment_image$id_number_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7263. ALTER TABLE [dbo].[community_event_comment_image] DROP CONSTRAINT [community_event_comment_image$id_number_idx]
  7264.  GO
  7265.  
  7266.  
  7267.  
  7268. ALTER TABLE [dbo].[community_event_comment_image]
  7269.  ADD CONSTRAINT [community_event_comment_image$id_number_idx]
  7270.  UNIQUE
  7271.    NONCLUSTERED ([id] ASC, [number] ASC)
  7272.  
  7273. GO
  7274.  
  7275. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_image$id_number_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7276. ALTER TABLE [dbo].[community_event_image] DROP CONSTRAINT [community_event_image$id_number_idx]
  7277.  GO
  7278.  
  7279.  
  7280.  
  7281. ALTER TABLE [dbo].[community_event_image]
  7282.  ADD CONSTRAINT [community_event_image$id_number_idx]
  7283.  UNIQUE
  7284.    NONCLUSTERED ([id] ASC, [number] ASC)
  7285.  
  7286. GO
  7287.  
  7288. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_member_position$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7289. ALTER TABLE [dbo].[community_member_position] DROP CONSTRAINT [community_member_position$name_UNIQUE_idx]
  7290.  GO
  7291.  
  7292.  
  7293.  
  7294. ALTER TABLE [dbo].[community_member_position]
  7295.  ADD CONSTRAINT [community_member_position$name_UNIQUE_idx]
  7296.  UNIQUE
  7297.    NONCLUSTERED ([community_member_id] ASC, [name] ASC)
  7298.  
  7299. GO
  7300.  
  7301. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_comment_image$id_number_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7302. ALTER TABLE [dbo].[community_topic_comment_image] DROP CONSTRAINT [community_topic_comment_image$id_number_idx]
  7303.  GO
  7304.  
  7305.  
  7306.  
  7307. ALTER TABLE [dbo].[community_topic_comment_image]
  7308.  ADD CONSTRAINT [community_topic_comment_image$id_number_idx]
  7309.  UNIQUE
  7310.    NONCLUSTERED ([id] ASC, [number] ASC)
  7311.  
  7312. GO
  7313.  
  7314. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_image$id_number_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7315. ALTER TABLE [dbo].[community_topic_image] DROP CONSTRAINT [community_topic_image$id_number_idx]
  7316.  GO
  7317.  
  7318.  
  7319.  
  7320. ALTER TABLE [dbo].[community_topic_image]
  7321.  ADD CONSTRAINT [community_topic_image$id_number_idx]
  7322.  UNIQUE
  7323.    NONCLUSTERED ([id] ASC, [number] ASC)
  7324.  
  7325. GO
  7326.  
  7327. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_image$diary_id_number_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7328. ALTER TABLE [dbo].[diary_image] DROP CONSTRAINT [diary_image$diary_id_number_idx]
  7329.  GO
  7330.  
  7331.  
  7332.  
  7333. ALTER TABLE [dbo].[diary_image]
  7334.  ADD CONSTRAINT [diary_image$diary_id_number_idx]
  7335.  UNIQUE
  7336.    NONCLUSTERED ([diary_id] ASC, [number] ASC)
  7337.  
  7338. GO
  7339.  
  7340. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'file$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7341. ALTER TABLE [dbo].[file] DROP CONSTRAINT [file$name_UNIQUE_idx]
  7342.  GO
  7343.  
  7344.  
  7345.  
  7346. ALTER TABLE [dbo].[file]
  7347.  ADD CONSTRAINT [file$name_UNIQUE_idx]
  7348.  UNIQUE
  7349.    NONCLUSTERED ([name] ASC)
  7350.  
  7351. GO
  7352.  
  7353. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_application_setting$hash_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7354. ALTER TABLE [dbo].[member_application_setting] DROP CONSTRAINT [member_application_setting$hash_UNIQUE_idx]
  7355.  GO
  7356.  
  7357.  
  7358.  
  7359. ALTER TABLE [dbo].[member_application_setting]
  7360.  ADD CONSTRAINT [member_application_setting$hash_UNIQUE_idx]
  7361.  UNIQUE
  7362.    NONCLUSTERED ([hash] ASC)
  7363.  
  7364. GO
  7365.  
  7366. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_relationship$member_id_to_from_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7367. ALTER TABLE [dbo].[member_relationship] DROP CONSTRAINT [member_relationship$member_id_to_from_UNIQUE_idx]
  7368.  GO
  7369.  
  7370.  
  7371.  
  7372. ALTER TABLE [dbo].[member_relationship]
  7373.  ADD CONSTRAINT [member_relationship$member_id_to_from_UNIQUE_idx]
  7374.  UNIQUE
  7375.    NONCLUSTERED ([member_id_to] ASC, [member_id_from] ASC)
  7376.  
  7377. GO
  7378.  
  7379. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_relationship$member_id_from_to_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7380. ALTER TABLE [dbo].[member_relationship] DROP CONSTRAINT [member_relationship$member_id_from_to_UNIQUE_idx]
  7381.  GO
  7382.  
  7383.  
  7384.  
  7385. ALTER TABLE [dbo].[member_relationship]
  7386.  ADD CONSTRAINT [member_relationship$member_id_from_to_UNIQUE_idx]
  7387.  UNIQUE
  7388.    NONCLUSTERED ([member_id_from] ASC, [member_id_to] ASC)
  7389.  
  7390. GO
  7391.  
  7392. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'notification_mail$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7393. ALTER TABLE [dbo].[notification_mail] DROP CONSTRAINT [notification_mail$name_UNIQUE_idx]
  7394.  GO
  7395.  
  7396.  
  7397.  
  7398. ALTER TABLE [dbo].[notification_mail]
  7399.  ADD CONSTRAINT [notification_mail$name_UNIQUE_idx]
  7400.  UNIQUE
  7401.    NONCLUSTERED ([name] ASC)
  7402.  
  7403. GO
  7404.  
  7405. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'o_auth_admin_token$key_secret_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7406. ALTER TABLE [dbo].[o_auth_admin_token] DROP CONSTRAINT [o_auth_admin_token$key_secret_UNIQUE_idx]
  7407.  GO
  7408.  
  7409.  
  7410.  
  7411. ALTER TABLE [dbo].[o_auth_admin_token]
  7412.  ADD CONSTRAINT [o_auth_admin_token$key_secret_UNIQUE_idx]
  7413.  UNIQUE
  7414.    NONCLUSTERED ([key_string] ASC, [secret] ASC)
  7415.  
  7416. GO
  7417.  
  7418. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'o_auth_member_token$key_secret_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7419. ALTER TABLE [dbo].[o_auth_member_token] DROP CONSTRAINT [o_auth_member_token$key_secret_UNIQUE_idx]
  7420.  GO
  7421.  
  7422.  
  7423.  
  7424. ALTER TABLE [dbo].[o_auth_member_token]
  7425.  ADD CONSTRAINT [o_auth_member_token$key_secret_UNIQUE_idx]
  7426.  UNIQUE
  7427.    NONCLUSTERED ([key_string] ASC, [secret] ASC)
  7428.  
  7429. GO
  7430.  
  7431. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'oauth_consumer$key_secret_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7432. ALTER TABLE [dbo].[oauth_consumer] DROP CONSTRAINT [oauth_consumer$key_secret_UNIQUE_idx]
  7433.  GO
  7434.  
  7435.  
  7436.  
  7437. ALTER TABLE [dbo].[oauth_consumer]
  7438.  ADD CONSTRAINT [oauth_consumer$key_secret_UNIQUE_idx]
  7439.  UNIQUE
  7440.    NONCLUSTERED ([key_string] ASC, [secret] ASC)
  7441.  
  7442. GO
  7443.  
  7444. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'plugin$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7445. ALTER TABLE [dbo].[plugin] DROP CONSTRAINT [plugin$name_UNIQUE_idx]
  7446.  GO
  7447.  
  7448.  
  7449.  
  7450. ALTER TABLE [dbo].[plugin]
  7451.  ADD CONSTRAINT [plugin$name_UNIQUE_idx]
  7452.  UNIQUE
  7453.    NONCLUSTERED ([name] ASC)
  7454.  
  7455. GO
  7456.  
  7457. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'profile$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7458. ALTER TABLE [dbo].[profile] DROP CONSTRAINT [profile$name_UNIQUE_idx]
  7459.  GO
  7460.  
  7461.  
  7462.  
  7463. ALTER TABLE [dbo].[profile]
  7464.  ADD CONSTRAINT [profile$name_UNIQUE_idx]
  7465.  UNIQUE
  7466.    NONCLUSTERED ([name] ASC)
  7467.  
  7468. GO
  7469.  
  7470. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'skin_config$plugin_name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7471. ALTER TABLE [dbo].[skin_config] DROP CONSTRAINT [skin_config$plugin_name_UNIQUE_idx]
  7472.  GO
  7473.  
  7474.  
  7475.  
  7476. ALTER TABLE [dbo].[skin_config]
  7477.  ADD CONSTRAINT [skin_config$plugin_name_UNIQUE_idx]
  7478.  UNIQUE
  7479.    NONCLUSTERED ([plugin] ASC, [name] ASC)
  7480.  
  7481. GO
  7482.  
  7483. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'sns_config$name_UNIQUE_idx'  AND sc.name=N'dbo'  AND type in (N'UQ'))
  7484. ALTER TABLE [dbo].[sns_config] DROP CONSTRAINT [sns_config$name_UNIQUE_idx]
  7485.  GO
  7486.  
  7487.  
  7488.  
  7489. ALTER TABLE [dbo].[sns_config]
  7490.  ADD CONSTRAINT [sns_config$name_UNIQUE_idx]
  7491.  UNIQUE
  7492.    NONCLUSTERED ([name] ASC)
  7493.  
  7494. GO
  7495.  
  7496. IF  EXISTS (
  7497.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7498.        ON so.object_id = si.object_id
  7499.        JOIN sys.schemas sc
  7500.        ON so.schema_id = sc.schema_id
  7501.        WHERE so.name = N'activity_image'  AND sc.name = N'dbo'  AND si.name = N'activity_data_id_idx' AND so.type in (N'U'))
  7502.    DROP INDEX [activity_data_id_idx] ON [dbo].[activity_image]
  7503. GO
  7504. CREATE NONCLUSTERED INDEX [activity_data_id_idx] ON [dbo].[activity_image]
  7505. (
  7506.    [activity_data_id] ASC
  7507. )
  7508. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7509. GO
  7510. GO
  7511. IF  EXISTS (
  7512.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7513.        ON so.object_id = si.object_id
  7514.        JOIN sys.schemas sc
  7515.        ON so.schema_id = sc.schema_id
  7516.        WHERE so.name = N'album_image'  AND sc.name = N'dbo'  AND si.name = N'album_id_idx' AND so.type in (N'U'))
  7517.    DROP INDEX [album_id_idx] ON [dbo].[album_image]
  7518. GO
  7519. CREATE NONCLUSTERED INDEX [album_id_idx] ON [dbo].[album_image]
  7520. (
  7521.    [album_id] ASC
  7522. )
  7523. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7524. GO
  7525. GO
  7526. IF  EXISTS (
  7527.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7528.        ON so.object_id = si.object_id
  7529.        JOIN sys.schemas sc
  7530.        ON so.schema_id = sc.schema_id
  7531.        WHERE so.name = N'member_application'  AND sc.name = N'dbo'  AND si.name = N'application_id_idx' AND so.type in (N'U'))
  7532.    DROP INDEX [application_id_idx] ON [dbo].[member_application]
  7533. GO
  7534. CREATE NONCLUSTERED INDEX [application_id_idx] ON [dbo].[member_application]
  7535. (
  7536.    [application_id] ASC
  7537. )
  7538. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7539. GO
  7540. GO
  7541. IF  EXISTS (
  7542.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7543.        ON so.object_id = si.object_id
  7544.        JOIN sys.schemas sc
  7545.        ON so.schema_id = sc.schema_id
  7546.        WHERE so.name = N'application_invite'  AND sc.name = N'dbo'  AND si.name = N'application_id_idx' AND so.type in (N'U'))
  7547.    DROP INDEX [application_id_idx] ON [dbo].[application_invite]
  7548. GO
  7549. CREATE NONCLUSTERED INDEX [application_id_idx] ON [dbo].[application_invite]
  7550. (
  7551.    [application_id] ASC
  7552. )
  7553. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7554. GO
  7555. GO
  7556. IF  EXISTS (
  7557.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7558.        ON so.object_id = si.object_id
  7559.        JOIN sys.schemas sc
  7560.        ON so.schema_id = sc.schema_id
  7561.        WHERE so.name = N'application_persistent_data'  AND sc.name = N'dbo'  AND si.name = N'application_id_idx' AND so.type in (N'U'))
  7562.    DROP INDEX [application_id_idx] ON [dbo].[application_persistent_data]
  7563. GO
  7564. CREATE NONCLUSTERED INDEX [application_id_idx] ON [dbo].[application_persistent_data]
  7565. (
  7566.    [application_id] ASC
  7567. )
  7568. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7569. GO
  7570. GO
  7571. IF  EXISTS (
  7572.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7573.        ON so.object_id = si.object_id
  7574.        JOIN sys.schemas sc
  7575.        ON so.schema_id = sc.schema_id
  7576.        WHERE so.name = N'application_lifecycle_event_queue'  AND sc.name = N'dbo'  AND si.name = N'application_id_idx' AND so.type in (N'U'))
  7577.    DROP INDEX [application_id_idx] ON [dbo].[application_lifecycle_event_queue]
  7578. GO
  7579. CREATE NONCLUSTERED INDEX [application_id_idx] ON [dbo].[application_lifecycle_event_queue]
  7580. (
  7581.    [application_id] ASC
  7582. )
  7583. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7584. GO
  7585. GO
  7586. IF  EXISTS (
  7587.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7588.        ON so.object_id = si.object_id
  7589.        JOIN sys.schemas sc
  7590.        ON so.schema_id = sc.schema_id
  7591.        WHERE so.name = N'sns_term'  AND sc.name = N'dbo'  AND si.name = N'application_INDEX_idx' AND so.type in (N'U'))
  7592.    DROP INDEX [application_INDEX_idx] ON [dbo].[sns_term]
  7593. GO
  7594. CREATE NONCLUSTERED INDEX [application_INDEX_idx] ON [dbo].[sns_term]
  7595. (
  7596.    [application] ASC
  7597. )
  7598. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7599. GO
  7600. GO
  7601. IF  EXISTS (
  7602.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7603.        ON so.object_id = si.object_id
  7604.        JOIN sys.schemas sc
  7605.        ON so.schema_id = sc.schema_id
  7606.        WHERE so.name = N'banner_use_image'  AND sc.name = N'dbo'  AND si.name = N'banner_id_idx' AND so.type in (N'U'))
  7607.    DROP INDEX [banner_id_idx] ON [dbo].[banner_use_image]
  7608. GO
  7609. CREATE NONCLUSTERED INDEX [banner_id_idx] ON [dbo].[banner_use_image]
  7610. (
  7611.    [banner_id] ASC
  7612. )
  7613. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7614. GO
  7615. GO
  7616. IF  EXISTS (
  7617.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7618.        ON so.object_id = si.object_id
  7619.        JOIN sys.schemas sc
  7620.        ON so.schema_id = sc.schema_id
  7621.        WHERE so.name = N'banner_use_image'  AND sc.name = N'dbo'  AND si.name = N'banner_image_id_idx' AND so.type in (N'U'))
  7622.    DROP INDEX [banner_image_id_idx] ON [dbo].[banner_use_image]
  7623. GO
  7624. CREATE NONCLUSTERED INDEX [banner_image_id_idx] ON [dbo].[banner_use_image]
  7625. (
  7626.    [banner_image_id] ASC
  7627. )
  7628. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7629. GO
  7630. GO
  7631. IF  EXISTS (
  7632.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7633.        ON so.object_id = si.object_id
  7634.        JOIN sys.schemas sc
  7635.        ON so.schema_id = sc.schema_id
  7636.        WHERE so.name = N'community'  AND sc.name = N'dbo'  AND si.name = N'community_category_id_idx' AND so.type in (N'U'))
  7637.    DROP INDEX [community_category_id_idx] ON [dbo].[community]
  7638. GO
  7639. CREATE NONCLUSTERED INDEX [community_category_id_idx] ON [dbo].[community]
  7640. (
  7641.    [community_category_id] ASC
  7642. )
  7643. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7644. GO
  7645. GO
  7646. IF  EXISTS (
  7647.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7648.        ON so.object_id = si.object_id
  7649.        JOIN sys.schemas sc
  7650.        ON so.schema_id = sc.schema_id
  7651.        WHERE so.name = N'community_event_comment'  AND sc.name = N'dbo'  AND si.name = N'community_event_id_idx' AND so.type in (N'U'))
  7652.    DROP INDEX [community_event_id_idx] ON [dbo].[community_event_comment]
  7653. GO
  7654. CREATE NONCLUSTERED INDEX [community_event_id_idx] ON [dbo].[community_event_comment]
  7655. (
  7656.    [community_event_id] ASC
  7657. )
  7658. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7659. GO
  7660. GO
  7661. IF  EXISTS (
  7662.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7663.        ON so.object_id = si.object_id
  7664.        JOIN sys.schemas sc
  7665.        ON so.schema_id = sc.schema_id
  7666.        WHERE so.name = N'community_event_member'  AND sc.name = N'dbo'  AND si.name = N'community_event_id_idx' AND so.type in (N'U'))
  7667.    DROP INDEX [community_event_id_idx] ON [dbo].[community_event_member]
  7668. GO
  7669. CREATE NONCLUSTERED INDEX [community_event_id_idx] ON [dbo].[community_event_member]
  7670. (
  7671.    [community_event_id] ASC
  7672. )
  7673. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7674. GO
  7675. GO
  7676. IF  EXISTS (
  7677.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7678.        ON so.object_id = si.object_id
  7679.        JOIN sys.schemas sc
  7680.        ON so.schema_id = sc.schema_id
  7681.        WHERE so.name = N'community_config'  AND sc.name = N'dbo'  AND si.name = N'community_id_idx' AND so.type in (N'U'))
  7682.    DROP INDEX [community_id_idx] ON [dbo].[community_config]
  7683. GO
  7684. CREATE NONCLUSTERED INDEX [community_id_idx] ON [dbo].[community_config]
  7685. (
  7686.    [community_id] ASC
  7687. )
  7688. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7689. GO
  7690. GO
  7691. IF  EXISTS (
  7692.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7693.        ON so.object_id = si.object_id
  7694.        JOIN sys.schemas sc
  7695.        ON so.schema_id = sc.schema_id
  7696.        WHERE so.name = N'community_topic'  AND sc.name = N'dbo'  AND si.name = N'community_id_idx' AND so.type in (N'U'))
  7697.    DROP INDEX [community_id_idx] ON [dbo].[community_topic]
  7698. GO
  7699. CREATE NONCLUSTERED INDEX [community_id_idx] ON [dbo].[community_topic]
  7700. (
  7701.    [community_id] ASC
  7702. )
  7703. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7704. GO
  7705. GO
  7706. IF  EXISTS (
  7707.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7708.        ON so.object_id = si.object_id
  7709.        JOIN sys.schemas sc
  7710.        ON so.schema_id = sc.schema_id
  7711.        WHERE so.name = N'community_member'  AND sc.name = N'dbo'  AND si.name = N'community_id_idx' AND so.type in (N'U'))
  7712.    DROP INDEX [community_id_idx] ON [dbo].[community_member]
  7713. GO
  7714. CREATE NONCLUSTERED INDEX [community_id_idx] ON [dbo].[community_member]
  7715. (
  7716.    [community_id] ASC
  7717. )
  7718. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7719. GO
  7720. GO
  7721. IF  EXISTS (
  7722.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7723.        ON so.object_id = si.object_id
  7724.        JOIN sys.schemas sc
  7725.        ON so.schema_id = sc.schema_id
  7726.        WHERE so.name = N'community_member_position'  AND sc.name = N'dbo'  AND si.name = N'community_id_idx' AND so.type in (N'U'))
  7727.    DROP INDEX [community_id_idx] ON [dbo].[community_member_position]
  7728. GO
  7729. CREATE NONCLUSTERED INDEX [community_id_idx] ON [dbo].[community_member_position]
  7730. (
  7731.    [community_id] ASC
  7732. )
  7733. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7734. GO
  7735. GO
  7736. IF  EXISTS (
  7737.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7738.        ON so.object_id = si.object_id
  7739.        JOIN sys.schemas sc
  7740.        ON so.schema_id = sc.schema_id
  7741.        WHERE so.name = N'community_event'  AND sc.name = N'dbo'  AND si.name = N'community_id_idx' AND so.type in (N'U'))
  7742.    DROP INDEX [community_id_idx] ON [dbo].[community_event]
  7743. GO
  7744. CREATE NONCLUSTERED INDEX [community_id_idx] ON [dbo].[community_event]
  7745. (
  7746.    [community_id] ASC
  7747. )
  7748. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7749. GO
  7750. GO
  7751. IF  EXISTS (
  7752.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7753.        ON so.object_id = si.object_id
  7754.        JOIN sys.schemas sc
  7755.        ON so.schema_id = sc.schema_id
  7756.        WHERE so.name = N'community_member_position'  AND sc.name = N'dbo'  AND si.name = N'community_member_id_idx' AND so.type in (N'U'))
  7757.    DROP INDEX [community_member_id_idx] ON [dbo].[community_member_position]
  7758. GO
  7759. CREATE NONCLUSTERED INDEX [community_member_id_idx] ON [dbo].[community_member_position]
  7760. (
  7761.    [community_member_id] ASC
  7762. )
  7763. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7764. GO
  7765. GO
  7766. IF  EXISTS (
  7767.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7768.        ON so.object_id = si.object_id
  7769.        JOIN sys.schemas sc
  7770.        ON so.schema_id = sc.schema_id
  7771.        WHERE so.name = N'community_topic_comment'  AND sc.name = N'dbo'  AND si.name = N'community_topic_id_idx' AND so.type in (N'U'))
  7772.    DROP INDEX [community_topic_id_idx] ON [dbo].[community_topic_comment]
  7773. GO
  7774. CREATE NONCLUSTERED INDEX [community_topic_id_idx] ON [dbo].[community_topic_comment]
  7775. (
  7776.    [community_topic_id] ASC
  7777. )
  7778. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7779. GO
  7780. GO
  7781. IF  EXISTS (
  7782.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7783.        ON so.object_id = si.object_id
  7784.        JOIN sys.schemas sc
  7785.        ON so.schema_id = sc.schema_id
  7786.        WHERE so.name = N'ashiato'  AND sc.name = N'dbo'  AND si.name = N'created_at_idx' AND so.type in (N'U'))
  7787.    DROP INDEX [created_at_idx] ON [dbo].[ashiato]
  7788. GO
  7789. CREATE NONCLUSTERED INDEX [created_at_idx] ON [dbo].[ashiato]
  7790. (
  7791.    [created_at] ASC
  7792. )
  7793. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7794. GO
  7795. GO
  7796. IF  EXISTS (
  7797.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7798.        ON so.object_id = si.object_id
  7799.        JOIN sys.schemas sc
  7800.        ON so.schema_id = sc.schema_id
  7801.        WHERE so.name = N'diary'  AND sc.name = N'dbo'  AND si.name = N'created_at_idx' AND so.type in (N'U'))
  7802.    DROP INDEX [created_at_idx] ON [dbo].[diary]
  7803. GO
  7804. CREATE NONCLUSTERED INDEX [created_at_idx] ON [dbo].[diary]
  7805. (
  7806.    [created_at] ASC
  7807. )
  7808. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7809. GO
  7810. GO
  7811. IF  EXISTS (
  7812.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7813.        ON so.object_id = si.object_id
  7814.        JOIN sys.schemas sc
  7815.        ON so.schema_id = sc.schema_id
  7816.        WHERE so.name = N'blog_rss_cache'  AND sc.name = N'dbo'  AND si.name = N'date_INDEX_idx' AND so.type in (N'U'))
  7817.    DROP INDEX [date_INDEX_idx] ON [dbo].[blog_rss_cache]
  7818. GO
  7819. CREATE NONCLUSTERED INDEX [date_INDEX_idx] ON [dbo].[blog_rss_cache]
  7820. (
  7821.    [date] ASC
  7822. )
  7823. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7824. GO
  7825. GO
  7826. IF  EXISTS (
  7827.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7828.        ON so.object_id = si.object_id
  7829.        JOIN sys.schemas sc
  7830.        ON so.schema_id = sc.schema_id
  7831.        WHERE so.name = N'diary_comment_image'  AND sc.name = N'dbo'  AND si.name = N'diary_comment_id_idx' AND so.type in (N'U'))
  7832.    DROP INDEX [diary_comment_id_idx] ON [dbo].[diary_comment_image]
  7833. GO
  7834. CREATE NONCLUSTERED INDEX [diary_comment_id_idx] ON [dbo].[diary_comment_image]
  7835. (
  7836.    [diary_comment_id] ASC
  7837. )
  7838. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7839. GO
  7840. GO
  7841. IF  EXISTS (
  7842.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7843.        ON so.object_id = si.object_id
  7844.        JOIN sys.schemas sc
  7845.        ON so.schema_id = sc.schema_id
  7846.        WHERE so.name = N'diary_comment'  AND sc.name = N'dbo'  AND si.name = N'diary_id_idx' AND so.type in (N'U'))
  7847.    DROP INDEX [diary_id_idx] ON [dbo].[diary_comment]
  7848. GO
  7849. CREATE NONCLUSTERED INDEX [diary_id_idx] ON [dbo].[diary_comment]
  7850. (
  7851.    [diary_id] ASC
  7852. )
  7853. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7854. GO
  7855. GO
  7856. IF  EXISTS (
  7857.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7858.        ON so.object_id = si.object_id
  7859.        JOIN sys.schemas sc
  7860.        ON so.schema_id = sc.schema_id
  7861.        WHERE so.name = N'diary_image'  AND sc.name = N'dbo'  AND si.name = N'diary_id_idx' AND so.type in (N'U'))
  7862.    DROP INDEX [diary_id_idx] ON [dbo].[diary_image]
  7863. GO
  7864. CREATE NONCLUSTERED INDEX [diary_id_idx] ON [dbo].[diary_image]
  7865. (
  7866.    [diary_id] ASC
  7867. )
  7868. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7869. GO
  7870. GO
  7871. IF  EXISTS (
  7872.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7873.        ON so.object_id = si.object_id
  7874.        JOIN sys.schemas sc
  7875.        ON so.schema_id = sc.schema_id
  7876.        WHERE so.name = N'diary_comment'  AND sc.name = N'dbo'  AND si.name = N'diary_id_number_idx' AND so.type in (N'U'))
  7877.    DROP INDEX [diary_id_number_idx] ON [dbo].[diary_comment]
  7878. GO
  7879. CREATE NONCLUSTERED INDEX [diary_id_number_idx] ON [dbo].[diary_comment]
  7880. (
  7881.    [diary_id] ASC,
  7882.    [number] ASC
  7883. )
  7884. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7885. GO
  7886. GO
  7887. IF  EXISTS (
  7888.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7889.        ON so.object_id = si.object_id
  7890.        JOIN sys.schemas sc
  7891.        ON so.schema_id = sc.schema_id
  7892.        WHERE so.name = N'community'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  7893.    DROP INDEX [file_id_idx] ON [dbo].[community]
  7894. GO
  7895. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[community]
  7896. (
  7897.    [file_id] ASC
  7898. )
  7899. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7900. GO
  7901. GO
  7902. IF  EXISTS (
  7903.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7904.        ON so.object_id = si.object_id
  7905.        JOIN sys.schemas sc
  7906.        ON so.schema_id = sc.schema_id
  7907.        WHERE so.name = N'oauth_consumer'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  7908.    DROP INDEX [file_id_idx] ON [dbo].[oauth_consumer]
  7909. GO
  7910. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[oauth_consumer]
  7911. (
  7912.    [file_id] ASC
  7913. )
  7914. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7915. GO
  7916. GO
  7917. IF  EXISTS (
  7918.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7919.        ON so.object_id = si.object_id
  7920.        JOIN sys.schemas sc
  7921.        ON so.schema_id = sc.schema_id
  7922.        WHERE so.name = N'banner_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  7923.    DROP INDEX [file_id_idx] ON [dbo].[banner_image]
  7924. GO
  7925. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[banner_image]
  7926. (
  7927.    [file_id] ASC
  7928. )
  7929. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7930. GO
  7931. GO
  7932. IF  EXISTS (
  7933.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7934.        ON so.object_id = si.object_id
  7935.        JOIN sys.schemas sc
  7936.        ON so.schema_id = sc.schema_id
  7937.        WHERE so.name = N'diary_comment_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  7938.    DROP INDEX [file_id_idx] ON [dbo].[diary_comment_image]
  7939. GO
  7940. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[diary_comment_image]
  7941. (
  7942.    [file_id] ASC
  7943. )
  7944. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7945. GO
  7946. GO
  7947. IF  EXISTS (
  7948.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7949.        ON so.object_id = si.object_id
  7950.        JOIN sys.schemas sc
  7951.        ON so.schema_id = sc.schema_id
  7952.        WHERE so.name = N'activity_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  7953.    DROP INDEX [file_id_idx] ON [dbo].[activity_image]
  7954. GO
  7955. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[activity_image]
  7956. (
  7957.    [file_id] ASC
  7958. )
  7959. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7960. GO
  7961. GO
  7962. IF  EXISTS (
  7963.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7964.        ON so.object_id = si.object_id
  7965.        JOIN sys.schemas sc
  7966.        ON so.schema_id = sc.schema_id
  7967.        WHERE so.name = N'member_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  7968.    DROP INDEX [file_id_idx] ON [dbo].[member_image]
  7969. GO
  7970. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[member_image]
  7971. (
  7972.    [file_id] ASC
  7973. )
  7974. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7975. GO
  7976. GO
  7977. IF  EXISTS (
  7978.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7979.        ON so.object_id = si.object_id
  7980.        JOIN sys.schemas sc
  7981.        ON so.schema_id = sc.schema_id
  7982.        WHERE so.name = N'diary_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  7983.    DROP INDEX [file_id_idx] ON [dbo].[diary_image]
  7984. GO
  7985. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[diary_image]
  7986. (
  7987.    [file_id] ASC
  7988. )
  7989. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  7990. GO
  7991. GO
  7992. IF  EXISTS (
  7993.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  7994.        ON so.object_id = si.object_id
  7995.        JOIN sys.schemas sc
  7996.        ON so.schema_id = sc.schema_id
  7997.        WHERE so.name = N'community_topic_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  7998.    DROP INDEX [file_id_idx] ON [dbo].[community_topic_image]
  7999. GO
  8000. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[community_topic_image]
  8001. (
  8002.    [file_id] ASC
  8003. )
  8004. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8005. GO
  8006. GO
  8007. IF  EXISTS (
  8008.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8009.        ON so.object_id = si.object_id
  8010.        JOIN sys.schemas sc
  8011.        ON so.schema_id = sc.schema_id
  8012.        WHERE so.name = N'community_event_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  8013.    DROP INDEX [file_id_idx] ON [dbo].[community_event_image]
  8014. GO
  8015. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[community_event_image]
  8016. (
  8017.    [file_id] ASC
  8018. )
  8019. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8020. GO
  8021. GO
  8022. IF  EXISTS (
  8023.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8024.        ON so.object_id = si.object_id
  8025.        JOIN sys.schemas sc
  8026.        ON so.schema_id = sc.schema_id
  8027.        WHERE so.name = N'message_file'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  8028.    DROP INDEX [file_id_idx] ON [dbo].[message_file]
  8029. GO
  8030. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[message_file]
  8031. (
  8032.    [file_id] ASC
  8033. )
  8034. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8035. GO
  8036. GO
  8037. IF  EXISTS (
  8038.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8039.        ON so.object_id = si.object_id
  8040.        JOIN sys.schemas sc
  8041.        ON so.schema_id = sc.schema_id
  8042.        WHERE so.name = N'community_topic_comment_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  8043.    DROP INDEX [file_id_idx] ON [dbo].[community_topic_comment_image]
  8044. GO
  8045. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[community_topic_comment_image]
  8046. (
  8047.    [file_id] ASC
  8048. )
  8049. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8050. GO
  8051. GO
  8052. IF  EXISTS (
  8053.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8054.        ON so.object_id = si.object_id
  8055.        JOIN sys.schemas sc
  8056.        ON so.schema_id = sc.schema_id
  8057.        WHERE so.name = N'album_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  8058.    DROP INDEX [file_id_idx] ON [dbo].[album_image]
  8059. GO
  8060. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[album_image]
  8061. (
  8062.    [file_id] ASC
  8063. )
  8064. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8065. GO
  8066. GO
  8067. IF  EXISTS (
  8068.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8069.        ON so.object_id = si.object_id
  8070.        JOIN sys.schemas sc
  8071.        ON so.schema_id = sc.schema_id
  8072.        WHERE so.name = N'community_event_comment_image'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  8073.    DROP INDEX [file_id_idx] ON [dbo].[community_event_comment_image]
  8074. GO
  8075. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[community_event_comment_image]
  8076. (
  8077.    [file_id] ASC
  8078. )
  8079. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8080. GO
  8081. GO
  8082. IF  EXISTS (
  8083.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8084.        ON so.object_id = si.object_id
  8085.        JOIN sys.schemas sc
  8086.        ON so.schema_id = sc.schema_id
  8087.        WHERE so.name = N'album'  AND sc.name = N'dbo'  AND si.name = N'file_id_idx' AND so.type in (N'U'))
  8088.    DROP INDEX [file_id_idx] ON [dbo].[album]
  8089. GO
  8090. CREATE NONCLUSTERED INDEX [file_id_idx] ON [dbo].[album]
  8091. (
  8092.    [file_id] ASC
  8093. )
  8094. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8095. GO
  8096. GO
  8097. IF  EXISTS (
  8098.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8099.        ON so.object_id = si.object_id
  8100.        JOIN sys.schemas sc
  8101.        ON so.schema_id = sc.schema_id
  8102.        WHERE so.name = N'application_invite'  AND sc.name = N'dbo'  AND si.name = N'from_member_id_idx' AND so.type in (N'U'))
  8103.    DROP INDEX [from_member_id_idx] ON [dbo].[application_invite]
  8104. GO
  8105. CREATE NONCLUSTERED INDEX [from_member_id_idx] ON [dbo].[application_invite]
  8106. (
  8107.    [from_member_id] ASC
  8108. )
  8109. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8110. GO
  8111. GO
  8112. IF  EXISTS (
  8113.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8114.        ON so.object_id = si.object_id
  8115.        JOIN sys.schemas sc
  8116.        ON so.schema_id = sc.schema_id
  8117.        WHERE so.name = N'gadget_config'  AND sc.name = N'dbo'  AND si.name = N'gadget_id_idx' AND so.type in (N'U'))
  8118.    DROP INDEX [gadget_id_idx] ON [dbo].[gadget_config]
  8119. GO
  8120. CREATE NONCLUSTERED INDEX [gadget_id_idx] ON [dbo].[gadget_config]
  8121. (
  8122.    [gadget_id] ASC
  8123. )
  8124. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8125. GO
  8126. GO
  8127. IF  EXISTS (
  8128.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8129.        ON so.object_id = si.object_id
  8130.        JOIN sys.schemas sc
  8131.        ON so.schema_id = sc.schema_id
  8132.        WHERE so.name = N'activity_data'  AND sc.name = N'dbo'  AND si.name = N'in_reply_to_activity_id_idx' AND so.type in (N'U'))
  8133.    DROP INDEX [in_reply_to_activity_id_idx] ON [dbo].[activity_data]
  8134. GO
  8135. CREATE NONCLUSTERED INDEX [in_reply_to_activity_id_idx] ON [dbo].[activity_data]
  8136. (
  8137.    [in_reply_to_activity_id] ASC
  8138. )
  8139. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8140. GO
  8141. GO
  8142. IF  EXISTS (
  8143.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8144.        ON so.object_id = si.object_id
  8145.        JOIN sys.schemas sc
  8146.        ON so.schema_id = sc.schema_id
  8147.        WHERE so.name = N'member'  AND sc.name = N'dbo'  AND si.name = N'invite_member_id_idx' AND so.type in (N'U'))
  8148.    DROP INDEX [invite_member_id_idx] ON [dbo].[member]
  8149. GO
  8150. CREATE NONCLUSTERED INDEX [invite_member_id_idx] ON [dbo].[member]
  8151. (
  8152.    [invite_member_id] ASC
  8153. )
  8154. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8155. GO
  8156. GO
  8157. IF  EXISTS (
  8158.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8159.        ON so.object_id = si.object_id
  8160.        JOIN sys.schemas sc
  8161.        ON so.schema_id = sc.schema_id
  8162.        WHERE so.name = N'member'  AND sc.name = N'dbo'  AND si.name = N'is_active_INDEX_idx' AND so.type in (N'U'))
  8163.    DROP INDEX [is_active_INDEX_idx] ON [dbo].[member]
  8164. GO
  8165. CREATE NONCLUSTERED INDEX [is_active_INDEX_idx] ON [dbo].[member]
  8166. (
  8167.    [is_active] ASC
  8168. )
  8169. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8170. GO
  8171. GO
  8172. IF  EXISTS (
  8173.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8174.        ON so.object_id = si.object_id
  8175.        JOIN sys.schemas sc
  8176.        ON so.schema_id = sc.schema_id
  8177.        WHERE so.name = N'plugin'  AND sc.name = N'dbo'  AND si.name = N'is_enabled_INDEX_idx' AND so.type in (N'U'))
  8178.    DROP INDEX [is_enabled_INDEX_idx] ON [dbo].[plugin]
  8179. GO
  8180. CREATE NONCLUSTERED INDEX [is_enabled_INDEX_idx] ON [dbo].[plugin]
  8181. (
  8182.    [is_enabled] ASC
  8183. )
  8184. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8185. GO
  8186. GO
  8187. IF  EXISTS (
  8188.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8189.        ON so.object_id = si.object_id
  8190.        JOIN sys.schemas sc
  8191.        ON so.schema_id = sc.schema_id
  8192.        WHERE so.name = N'notification_mail'  AND sc.name = N'dbo'  AND si.name = N'is_enabled_INDEX_idx' AND so.type in (N'U'))
  8193.    DROP INDEX [is_enabled_INDEX_idx] ON [dbo].[notification_mail]
  8194. GO
  8195. CREATE NONCLUSTERED INDEX [is_enabled_INDEX_idx] ON [dbo].[notification_mail]
  8196. (
  8197.    [is_enabled] ASC
  8198. )
  8199. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8200. GO
  8201. GO
  8202. IF  EXISTS (
  8203.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8204.        ON so.object_id = si.object_id
  8205.        JOIN sys.schemas sc
  8206.        ON so.schema_id = sc.schema_id
  8207.        WHERE so.name = N'diary'  AND sc.name = N'dbo'  AND si.name = N'is_open_created_at_idx' AND so.type in (N'U'))
  8208.    DROP INDEX [is_open_created_at_idx] ON [dbo].[diary]
  8209. GO
  8210. CREATE NONCLUSTERED INDEX [is_open_created_at_idx] ON [dbo].[diary]
  8211. (
  8212.    [is_open] ASC,
  8213.    [created_at] ASC
  8214. )
  8215. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8216. GO
  8217. GO
  8218. IF  EXISTS (
  8219.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8220.        ON so.object_id = si.object_id
  8221.        JOIN sys.schemas sc
  8222.        ON so.schema_id = sc.schema_id
  8223.        WHERE so.name = N'member_profile'  AND sc.name = N'dbo'  AND si.name = N'lft_INDEX_idx' AND so.type in (N'U'))
  8224.    DROP INDEX [lft_INDEX_idx] ON [dbo].[member_profile]
  8225. GO
  8226. CREATE NONCLUSTERED INDEX [lft_INDEX_idx] ON [dbo].[member_profile]
  8227. (
  8228.    [lft] ASC
  8229. )
  8230. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8231. GO
  8232. GO
  8233. IF  EXISTS (
  8234.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8235.        ON so.object_id = si.object_id
  8236.        JOIN sys.schemas sc
  8237.        ON so.schema_id = sc.schema_id
  8238.        WHERE so.name = N'community_category'  AND sc.name = N'dbo'  AND si.name = N'lft_INDEX_idx' AND so.type in (N'U'))
  8239.    DROP INDEX [lft_INDEX_idx] ON [dbo].[community_category]
  8240. GO
  8241. CREATE NONCLUSTERED INDEX [lft_INDEX_idx] ON [dbo].[community_category]
  8242. (
  8243.    [lft] ASC
  8244. )
  8245. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8246. GO
  8247. GO
  8248. IF  EXISTS (
  8249.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8250.        ON so.object_id = si.object_id
  8251.        JOIN sys.schemas sc
  8252.        ON so.schema_id = sc.schema_id
  8253.        WHERE so.name = N'member_application_setting'  AND sc.name = N'dbo'  AND si.name = N'member_application_id_idx' AND so.type in (N'U'))
  8254.    DROP INDEX [member_application_id_idx] ON [dbo].[member_application_setting]
  8255. GO
  8256. CREATE NONCLUSTERED INDEX [member_application_id_idx] ON [dbo].[member_application_setting]
  8257. (
  8258.    [member_application_id] ASC
  8259. )
  8260. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8261. GO
  8262. GO
  8263. IF  EXISTS (
  8264.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8265.        ON so.object_id = si.object_id
  8266.        JOIN sys.schemas sc
  8267.        ON so.schema_id = sc.schema_id
  8268.        WHERE so.name = N'diary'  AND sc.name = N'dbo'  AND si.name = N'member_id_created_at_idx' AND so.type in (N'U'))
  8269.    DROP INDEX [member_id_created_at_idx] ON [dbo].[diary]
  8270. GO
  8271. CREATE NONCLUSTERED INDEX [member_id_created_at_idx] ON [dbo].[diary]
  8272. (
  8273.    [member_id] ASC,
  8274.    [created_at] ASC
  8275. )
  8276. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8277. GO
  8278. GO
  8279. IF  EXISTS (
  8280.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8281.        ON so.object_id = si.object_id
  8282.        JOIN sys.schemas sc
  8283.        ON so.schema_id = sc.schema_id
  8284.        WHERE so.name = N'member_relationship'  AND sc.name = N'dbo'  AND si.name = N'member_id_from_idx' AND so.type in (N'U'))
  8285.    DROP INDEX [member_id_from_idx] ON [dbo].[member_relationship]
  8286. GO
  8287. CREATE NONCLUSTERED INDEX [member_id_from_idx] ON [dbo].[member_relationship]
  8288. (
  8289.    [member_id_from] ASC
  8290. )
  8291. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8292. GO
  8293. GO
  8294. IF  EXISTS (
  8295.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8296.        ON so.object_id = si.object_id
  8297.        JOIN sys.schemas sc
  8298.        ON so.schema_id = sc.schema_id
  8299.        WHERE so.name = N'ashiato'  AND sc.name = N'dbo'  AND si.name = N'member_id_from_idx' AND so.type in (N'U'))
  8300.    DROP INDEX [member_id_from_idx] ON [dbo].[ashiato]
  8301. GO
  8302. CREATE NONCLUSTERED INDEX [member_id_from_idx] ON [dbo].[ashiato]
  8303. (
  8304.    [member_id_from] ASC
  8305. )
  8306. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8307. GO
  8308. GO
  8309. IF  EXISTS (
  8310.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8311.        ON so.object_id = si.object_id
  8312.        JOIN sys.schemas sc
  8313.        ON so.schema_id = sc.schema_id
  8314.        WHERE so.name = N'favorite'  AND sc.name = N'dbo'  AND si.name = N'member_id_from_INDEX_idx' AND so.type in (N'U'))
  8315.    DROP INDEX [member_id_from_INDEX_idx] ON [dbo].[favorite]
  8316. GO
  8317. CREATE NONCLUSTERED INDEX [member_id_from_INDEX_idx] ON [dbo].[favorite]
  8318. (
  8319.    [member_id_from] ASC
  8320. )
  8321. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8322. GO
  8323. GO
  8324. IF  EXISTS (
  8325.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8326.        ON so.object_id = si.object_id
  8327.        JOIN sys.schemas sc
  8328.        ON so.schema_id = sc.schema_id
  8329.        WHERE so.name = N'member_profile'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8330.    DROP INDEX [member_id_idx] ON [dbo].[member_profile]
  8331. GO
  8332. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[member_profile]
  8333. (
  8334.    [member_id] ASC
  8335. )
  8336. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8337. GO
  8338. GO
  8339. IF  EXISTS (
  8340.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8341.        ON so.object_id = si.object_id
  8342.        JOIN sys.schemas sc
  8343.        ON so.schema_id = sc.schema_id
  8344.        WHERE so.name = N'album'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8345.    DROP INDEX [member_id_idx] ON [dbo].[album]
  8346. GO
  8347. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[album]
  8348. (
  8349.    [member_id] ASC
  8350. )
  8351. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8352. GO
  8353. GO
  8354. IF  EXISTS (
  8355.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8356.        ON so.object_id = si.object_id
  8357.        JOIN sys.schemas sc
  8358.        ON so.schema_id = sc.schema_id
  8359.        WHERE so.name = N'community_event_comment'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8360.    DROP INDEX [member_id_idx] ON [dbo].[community_event_comment]
  8361. GO
  8362. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[community_event_comment]
  8363. (
  8364.    [member_id] ASC
  8365. )
  8366. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8367. GO
  8368. GO
  8369. IF  EXISTS (
  8370.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8371.        ON so.object_id = si.object_id
  8372.        JOIN sys.schemas sc
  8373.        ON so.schema_id = sc.schema_id
  8374.        WHERE so.name = N'community_event_member'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8375.    DROP INDEX [member_id_idx] ON [dbo].[community_event_member]
  8376. GO
  8377. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[community_event_member]
  8378. (
  8379.    [member_id] ASC
  8380. )
  8381. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8382. GO
  8383. GO
  8384. IF  EXISTS (
  8385.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8386.        ON so.object_id = si.object_id
  8387.        JOIN sys.schemas sc
  8388.        ON so.schema_id = sc.schema_id
  8389.        WHERE so.name = N'community_event'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8390.    DROP INDEX [member_id_idx] ON [dbo].[community_event]
  8391. GO
  8392. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[community_event]
  8393. (
  8394.    [member_id] ASC
  8395. )
  8396. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8397. GO
  8398. GO
  8399. IF  EXISTS (
  8400.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8401.        ON so.object_id = si.object_id
  8402.        JOIN sys.schemas sc
  8403.        ON so.schema_id = sc.schema_id
  8404.        WHERE so.name = N'application_persistent_data'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8405.    DROP INDEX [member_id_idx] ON [dbo].[application_persistent_data]
  8406. GO
  8407. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[application_persistent_data]
  8408. (
  8409.    [member_id] ASC
  8410. )
  8411. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8412. GO
  8413. GO
  8414. IF  EXISTS (
  8415.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8416.        ON so.object_id = si.object_id
  8417.        JOIN sys.schemas sc
  8418.        ON so.schema_id = sc.schema_id
  8419.        WHERE so.name = N'application_lifecycle_event_queue'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8420.    DROP INDEX [member_id_idx] ON [dbo].[application_lifecycle_event_queue]
  8421. GO
  8422. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[application_lifecycle_event_queue]
  8423. (
  8424.    [member_id] ASC
  8425. )
  8426. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8427. GO
  8428. GO
  8429. IF  EXISTS (
  8430.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8431.        ON so.object_id = si.object_id
  8432.        JOIN sys.schemas sc
  8433.        ON so.schema_id = sc.schema_id
  8434.        WHERE so.name = N'message'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8435.    DROP INDEX [member_id_idx] ON [dbo].[message]
  8436. GO
  8437. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[message]
  8438. (
  8439.    [member_id] ASC
  8440. )
  8441. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8442. GO
  8443. GO
  8444. IF  EXISTS (
  8445.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8446.        ON so.object_id = si.object_id
  8447.        JOIN sys.schemas sc
  8448.        ON so.schema_id = sc.schema_id
  8449.        WHERE so.name = N'blog_rss_cache'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8450.    DROP INDEX [member_id_idx] ON [dbo].[blog_rss_cache]
  8451. GO
  8452. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[blog_rss_cache]
  8453. (
  8454.    [member_id] ASC
  8455. )
  8456. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8457. GO
  8458. GO
  8459. IF  EXISTS (
  8460.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8461.        ON so.object_id = si.object_id
  8462.        JOIN sys.schemas sc
  8463.        ON so.schema_id = sc.schema_id
  8464.        WHERE so.name = N'album_image'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8465.    DROP INDEX [member_id_idx] ON [dbo].[album_image]
  8466. GO
  8467. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[album_image]
  8468. (
  8469.    [member_id] ASC
  8470. )
  8471. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8472. GO
  8473. GO
  8474. IF  EXISTS (
  8475.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8476.        ON so.object_id = si.object_id
  8477.        JOIN sys.schemas sc
  8478.        ON so.schema_id = sc.schema_id
  8479.        WHERE so.name = N'application'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8480.    DROP INDEX [member_id_idx] ON [dbo].[application]
  8481. GO
  8482. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[application]
  8483. (
  8484.    [member_id] ASC
  8485. )
  8486. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8487. GO
  8488. GO
  8489. IF  EXISTS (
  8490.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8491.        ON so.object_id = si.object_id
  8492.        JOIN sys.schemas sc
  8493.        ON so.schema_id = sc.schema_id
  8494.        WHERE so.name = N'o_auth_member_token'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8495.    DROP INDEX [member_id_idx] ON [dbo].[o_auth_member_token]
  8496. GO
  8497. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[o_auth_member_token]
  8498. (
  8499.    [member_id] ASC
  8500. )
  8501. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8502. GO
  8503. GO
  8504. IF  EXISTS (
  8505.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8506.        ON so.object_id = si.object_id
  8507.        JOIN sys.schemas sc
  8508.        ON so.schema_id = sc.schema_id
  8509.        WHERE so.name = N'deleted_message'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8510.    DROP INDEX [member_id_idx] ON [dbo].[deleted_message]
  8511. GO
  8512. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[deleted_message]
  8513. (
  8514.    [member_id] ASC
  8515. )
  8516. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8517. GO
  8518. GO
  8519. IF  EXISTS (
  8520.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8521.        ON so.object_id = si.object_id
  8522.        JOIN sys.schemas sc
  8523.        ON so.schema_id = sc.schema_id
  8524.        WHERE so.name = N'oauth_consumer'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8525.    DROP INDEX [member_id_idx] ON [dbo].[oauth_consumer]
  8526. GO
  8527. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[oauth_consumer]
  8528. (
  8529.    [member_id] ASC
  8530. )
  8531. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8532. GO
  8533. GO
  8534. IF  EXISTS (
  8535.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8536.        ON so.object_id = si.object_id
  8537.        JOIN sys.schemas sc
  8538.        ON so.schema_id = sc.schema_id
  8539.        WHERE so.name = N'activity_data'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8540.    DROP INDEX [member_id_idx] ON [dbo].[activity_data]
  8541. GO
  8542. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[activity_data]
  8543. (
  8544.    [member_id] ASC
  8545. )
  8546. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8547. GO
  8548. GO
  8549. IF  EXISTS (
  8550.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8551.        ON so.object_id = si.object_id
  8552.        JOIN sys.schemas sc
  8553.        ON so.schema_id = sc.schema_id
  8554.        WHERE so.name = N'diary_comment'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8555.    DROP INDEX [member_id_idx] ON [dbo].[diary_comment]
  8556. GO
  8557. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[diary_comment]
  8558. (
  8559.    [member_id] ASC
  8560. )
  8561. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8562. GO
  8563. GO
  8564. IF  EXISTS (
  8565.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8566.        ON so.object_id = si.object_id
  8567.        JOIN sys.schemas sc
  8568.        ON so.schema_id = sc.schema_id
  8569.        WHERE so.name = N'diary_comment_unread'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8570.    DROP INDEX [member_id_idx] ON [dbo].[diary_comment_unread]
  8571. GO
  8572. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[diary_comment_unread]
  8573. (
  8574.    [member_id] ASC
  8575. )
  8576. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8577. GO
  8578. GO
  8579. IF  EXISTS (
  8580.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8581.        ON so.object_id = si.object_id
  8582.        JOIN sys.schemas sc
  8583.        ON so.schema_id = sc.schema_id
  8584.        WHERE so.name = N'member_application'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8585.    DROP INDEX [member_id_idx] ON [dbo].[member_application]
  8586. GO
  8587. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[member_application]
  8588. (
  8589.    [member_id] ASC
  8590. )
  8591. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8592. GO
  8593. GO
  8594. IF  EXISTS (
  8595.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8596.        ON so.object_id = si.object_id
  8597.        JOIN sys.schemas sc
  8598.        ON so.schema_id = sc.schema_id
  8599.        WHERE so.name = N'diary'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8600.    DROP INDEX [member_id_idx] ON [dbo].[diary]
  8601. GO
  8602. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[diary]
  8603. (
  8604.    [member_id] ASC
  8605. )
  8606. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8607. GO
  8608. GO
  8609. IF  EXISTS (
  8610.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8611.        ON so.object_id = si.object_id
  8612.        JOIN sys.schemas sc
  8613.        ON so.schema_id = sc.schema_id
  8614.        WHERE so.name = N'message_send_list'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8615.    DROP INDEX [member_id_idx] ON [dbo].[message_send_list]
  8616. GO
  8617. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[message_send_list]
  8618. (
  8619.    [member_id] ASC
  8620. )
  8621. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8622. GO
  8623. GO
  8624. IF  EXISTS (
  8625.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8626.        ON so.object_id = si.object_id
  8627.        JOIN sys.schemas sc
  8628.        ON so.schema_id = sc.schema_id
  8629.        WHERE so.name = N'openid_trust_log'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8630.    DROP INDEX [member_id_idx] ON [dbo].[openid_trust_log]
  8631. GO
  8632. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[openid_trust_log]
  8633. (
  8634.    [member_id] ASC
  8635. )
  8636. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8637. GO
  8638. GO
  8639. IF  EXISTS (
  8640.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8641.        ON so.object_id = si.object_id
  8642.        JOIN sys.schemas sc
  8643.        ON so.schema_id = sc.schema_id
  8644.        WHERE so.name = N'community_member'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8645.    DROP INDEX [member_id_idx] ON [dbo].[community_member]
  8646. GO
  8647. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[community_member]
  8648. (
  8649.    [member_id] ASC
  8650. )
  8651. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8652. GO
  8653. GO
  8654. IF  EXISTS (
  8655.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8656.        ON so.object_id = si.object_id
  8657.        JOIN sys.schemas sc
  8658.        ON so.schema_id = sc.schema_id
  8659.        WHERE so.name = N'member_image'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8660.    DROP INDEX [member_id_idx] ON [dbo].[member_image]
  8661. GO
  8662. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[member_image]
  8663. (
  8664.    [member_id] ASC
  8665. )
  8666. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8667. GO
  8668. GO
  8669. IF  EXISTS (
  8670.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8671.        ON so.object_id = si.object_id
  8672.        JOIN sys.schemas sc
  8673.        ON so.schema_id = sc.schema_id
  8674.        WHERE so.name = N'community_topic'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8675.    DROP INDEX [member_id_idx] ON [dbo].[community_topic]
  8676. GO
  8677. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[community_topic]
  8678. (
  8679.    [member_id] ASC
  8680. )
  8681. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8682. GO
  8683. GO
  8684. IF  EXISTS (
  8685.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8686.        ON so.object_id = si.object_id
  8687.        JOIN sys.schemas sc
  8688.        ON so.schema_id = sc.schema_id
  8689.        WHERE so.name = N'community_topic_comment'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8690.    DROP INDEX [member_id_idx] ON [dbo].[community_topic_comment]
  8691. GO
  8692. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[community_topic_comment]
  8693. (
  8694.    [member_id] ASC
  8695. )
  8696. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8697. GO
  8698. GO
  8699. IF  EXISTS (
  8700.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8701.        ON so.object_id = si.object_id
  8702.        JOIN sys.schemas sc
  8703.        ON so.schema_id = sc.schema_id
  8704.        WHERE so.name = N'community_member_position'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8705.    DROP INDEX [member_id_idx] ON [dbo].[community_member_position]
  8706. GO
  8707. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[community_member_position]
  8708. (
  8709.    [member_id] ASC
  8710. )
  8711. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8712. GO
  8713. GO
  8714. IF  EXISTS (
  8715.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8716.        ON so.object_id = si.object_id
  8717.        JOIN sys.schemas sc
  8718.        ON so.schema_id = sc.schema_id
  8719.        WHERE so.name = N'member_config'  AND sc.name = N'dbo'  AND si.name = N'member_id_idx' AND so.type in (N'U'))
  8720.    DROP INDEX [member_id_idx] ON [dbo].[member_config]
  8721. GO
  8722. CREATE NONCLUSTERED INDEX [member_id_idx] ON [dbo].[member_config]
  8723. (
  8724.    [member_id] ASC
  8725. )
  8726. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8727. GO
  8728. GO
  8729. IF  EXISTS (
  8730.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8731.        ON so.object_id = si.object_id
  8732.        JOIN sys.schemas sc
  8733.        ON so.schema_id = sc.schema_id
  8734.        WHERE so.name = N'diary_comment_update'  AND sc.name = N'dbo'  AND si.name = N'member_id_last_comment_time_idx' AND so.type in (N'U'))
  8735.    DROP INDEX [member_id_last_comment_time_idx] ON [dbo].[diary_comment_update]
  8736. GO
  8737. CREATE NONCLUSTERED INDEX [member_id_last_comment_time_idx] ON [dbo].[diary_comment_update]
  8738. (
  8739.    [member_id] ASC,
  8740.    [last_comment_time] ASC
  8741. )
  8742. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8743. GO
  8744. GO
  8745. IF  EXISTS (
  8746.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8747.        ON so.object_id = si.object_id
  8748.        JOIN sys.schemas sc
  8749.        ON so.schema_id = sc.schema_id
  8750.        WHERE so.name = N'ashiato'  AND sc.name = N'dbo'  AND si.name = N'member_id_to_idx' AND so.type in (N'U'))
  8751.    DROP INDEX [member_id_to_idx] ON [dbo].[ashiato]
  8752. GO
  8753. CREATE NONCLUSTERED INDEX [member_id_to_idx] ON [dbo].[ashiato]
  8754. (
  8755.    [member_id_to] ASC
  8756. )
  8757. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8758. GO
  8759. GO
  8760. IF  EXISTS (
  8761.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8762.        ON so.object_id = si.object_id
  8763.        JOIN sys.schemas sc
  8764.        ON so.schema_id = sc.schema_id
  8765.        WHERE so.name = N'member_relationship'  AND sc.name = N'dbo'  AND si.name = N'member_id_to_idx' AND so.type in (N'U'))
  8766.    DROP INDEX [member_id_to_idx] ON [dbo].[member_relationship]
  8767. GO
  8768. CREATE NONCLUSTERED INDEX [member_id_to_idx] ON [dbo].[member_relationship]
  8769. (
  8770.    [member_id_to] ASC
  8771. )
  8772. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8773. GO
  8774. GO
  8775. IF  EXISTS (
  8776.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8777.        ON so.object_id = si.object_id
  8778.        JOIN sys.schemas sc
  8779.        ON so.schema_id = sc.schema_id
  8780.        WHERE so.name = N'favorite'  AND sc.name = N'dbo'  AND si.name = N'member_id_to_idx' AND so.type in (N'U'))
  8781.    DROP INDEX [member_id_to_idx] ON [dbo].[favorite]
  8782. GO
  8783. CREATE NONCLUSTERED INDEX [member_id_to_idx] ON [dbo].[favorite]
  8784. (
  8785.    [member_id_to] ASC
  8786. )
  8787. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8788. GO
  8789. GO
  8790. IF  EXISTS (
  8791.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8792.        ON so.object_id = si.object_id
  8793.        JOIN sys.schemas sc
  8794.        ON so.schema_id = sc.schema_id
  8795.        WHERE so.name = N'ashiato'  AND sc.name = N'dbo'  AND si.name = N'member_id_to_member_id_from_updated_at_idx' AND so.type in (N'U'))
  8796.    DROP INDEX [member_id_to_member_id_from_updated_at_idx] ON [dbo].[ashiato]
  8797. GO
  8798. CREATE NONCLUSTERED INDEX [member_id_to_member_id_from_updated_at_idx] ON [dbo].[ashiato]
  8799. (
  8800.    [member_id_to] ASC,
  8801.    [member_id_from] ASC,
  8802.    [updated_at] ASC
  8803. )
  8804. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8805. GO
  8806. GO
  8807. IF  EXISTS (
  8808.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8809.        ON so.object_id = si.object_id
  8810.        JOIN sys.schemas sc
  8811.        ON so.schema_id = sc.schema_id
  8812.        WHERE so.name = N'ashiato'  AND sc.name = N'dbo'  AND si.name = N'member_id_to_r_date_idx' AND so.type in (N'U'))
  8813.    DROP INDEX [member_id_to_r_date_idx] ON [dbo].[ashiato]
  8814. GO
  8815. CREATE NONCLUSTERED INDEX [member_id_to_r_date_idx] ON [dbo].[ashiato]
  8816. (
  8817.    [member_id_to] ASC,
  8818.    [r_date] ASC
  8819. )
  8820. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8821. GO
  8822. GO
  8823. IF  EXISTS (
  8824.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8825.        ON so.object_id = si.object_id
  8826.        JOIN sys.schemas sc
  8827.        ON so.schema_id = sc.schema_id
  8828.        WHERE so.name = N'message_send_list'  AND sc.name = N'dbo'  AND si.name = N'message_id_idx' AND so.type in (N'U'))
  8829.    DROP INDEX [message_id_idx] ON [dbo].[message_send_list]
  8830. GO
  8831. CREATE NONCLUSTERED INDEX [message_id_idx] ON [dbo].[message_send_list]
  8832. (
  8833.    [message_id] ASC
  8834. )
  8835. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8836. GO
  8837. GO
  8838. IF  EXISTS (
  8839.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8840.        ON so.object_id = si.object_id
  8841.        JOIN sys.schemas sc
  8842.        ON so.schema_id = sc.schema_id
  8843.        WHERE so.name = N'message_file'  AND sc.name = N'dbo'  AND si.name = N'message_id_idx' AND so.type in (N'U'))
  8844.    DROP INDEX [message_id_idx] ON [dbo].[message_file]
  8845. GO
  8846. CREATE NONCLUSTERED INDEX [message_id_idx] ON [dbo].[message_file]
  8847. (
  8848.    [message_id] ASC
  8849. )
  8850. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8851. GO
  8852. GO
  8853. IF  EXISTS (
  8854.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8855.        ON so.object_id = si.object_id
  8856.        JOIN sys.schemas sc
  8857.        ON so.schema_id = sc.schema_id
  8858.        WHERE so.name = N'message'  AND sc.name = N'dbo'  AND si.name = N'message_type_id_idx' AND so.type in (N'U'))
  8859.    DROP INDEX [message_type_id_idx] ON [dbo].[message]
  8860. GO
  8861. CREATE NONCLUSTERED INDEX [message_type_id_idx] ON [dbo].[message]
  8862. (
  8863.    [message_type_id] ASC
  8864. )
  8865. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8866. GO
  8867. GO
  8868. IF  EXISTS (
  8869.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8870.        ON so.object_id = si.object_id
  8871.        JOIN sys.schemas sc
  8872.        ON so.schema_id = sc.schema_id
  8873.        WHERE so.name = N'member_config'  AND sc.name = N'dbo'  AND si.name = N'name_INDEX_idx' AND so.type in (N'U'))
  8874.    DROP INDEX [name_INDEX_idx] ON [dbo].[member_config]
  8875. GO
  8876. CREATE NONCLUSTERED INDEX [name_INDEX_idx] ON [dbo].[member_config]
  8877. (
  8878.    [name] ASC
  8879. )
  8880. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8881. GO
  8882. GO
  8883. IF  EXISTS (
  8884.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8885.        ON so.object_id = si.object_id
  8886.        JOIN sys.schemas sc
  8887.        ON so.schema_id = sc.schema_id
  8888.        WHERE so.name = N'member_config'  AND sc.name = N'dbo'  AND si.name = N'name_value_hash_INDEX_idx' AND so.type in (N'U'))
  8889.    DROP INDEX [name_value_hash_INDEX_idx] ON [dbo].[member_config]
  8890. GO
  8891. CREATE NONCLUSTERED INDEX [name_value_hash_INDEX_idx] ON [dbo].[member_config]
  8892. (
  8893.    [name_value_hash] ASC
  8894. )
  8895. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8896. GO
  8897. GO
  8898. IF  EXISTS (
  8899.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8900.        ON so.object_id = si.object_id
  8901.        JOIN sys.schemas sc
  8902.        ON so.schema_id = sc.schema_id
  8903.        WHERE so.name = N'o_auth_admin_token'  AND sc.name = N'dbo'  AND si.name = N'oauth_consumer_id_idx' AND so.type in (N'U'))
  8904.    DROP INDEX [oauth_consumer_id_idx] ON [dbo].[o_auth_admin_token]
  8905. GO
  8906. CREATE NONCLUSTERED INDEX [oauth_consumer_id_idx] ON [dbo].[o_auth_admin_token]
  8907. (
  8908.    [oauth_consumer_id] ASC
  8909. )
  8910. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8911. GO
  8912. GO
  8913. IF  EXISTS (
  8914.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8915.        ON so.object_id = si.object_id
  8916.        JOIN sys.schemas sc
  8917.        ON so.schema_id = sc.schema_id
  8918.        WHERE so.name = N'o_auth_member_token'  AND sc.name = N'dbo'  AND si.name = N'oauth_consumer_id_idx' AND so.type in (N'U'))
  8919.    DROP INDEX [oauth_consumer_id_idx] ON [dbo].[o_auth_member_token]
  8920. GO
  8921. CREATE NONCLUSTERED INDEX [oauth_consumer_id_idx] ON [dbo].[o_auth_member_token]
  8922. (
  8923.    [oauth_consumer_id] ASC
  8924. )
  8925. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8926. GO
  8927. GO
  8928. IF  EXISTS (
  8929.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8930.        ON so.object_id = si.object_id
  8931.        JOIN sys.schemas sc
  8932.        ON so.schema_id = sc.schema_id
  8933.        WHERE so.name = N'community_event_image'  AND sc.name = N'dbo'  AND si.name = N'post_id_idx' AND so.type in (N'U'))
  8934.    DROP INDEX [post_id_idx] ON [dbo].[community_event_image]
  8935. GO
  8936. CREATE NONCLUSTERED INDEX [post_id_idx] ON [dbo].[community_event_image]
  8937. (
  8938.    [post_id] ASC
  8939. )
  8940. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8941. GO
  8942. GO
  8943. IF  EXISTS (
  8944.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8945.        ON so.object_id = si.object_id
  8946.        JOIN sys.schemas sc
  8947.        ON so.schema_id = sc.schema_id
  8948.        WHERE so.name = N'community_topic_comment_image'  AND sc.name = N'dbo'  AND si.name = N'post_id_idx' AND so.type in (N'U'))
  8949.    DROP INDEX [post_id_idx] ON [dbo].[community_topic_comment_image]
  8950. GO
  8951. CREATE NONCLUSTERED INDEX [post_id_idx] ON [dbo].[community_topic_comment_image]
  8952. (
  8953.    [post_id] ASC
  8954. )
  8955. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8956. GO
  8957. GO
  8958. IF  EXISTS (
  8959.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8960.        ON so.object_id = si.object_id
  8961.        JOIN sys.schemas sc
  8962.        ON so.schema_id = sc.schema_id
  8963.        WHERE so.name = N'community_event_comment_image'  AND sc.name = N'dbo'  AND si.name = N'post_id_idx' AND so.type in (N'U'))
  8964.    DROP INDEX [post_id_idx] ON [dbo].[community_event_comment_image]
  8965. GO
  8966. CREATE NONCLUSTERED INDEX [post_id_idx] ON [dbo].[community_event_comment_image]
  8967. (
  8968.    [post_id] ASC
  8969. )
  8970. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8971. GO
  8972. GO
  8973. IF  EXISTS (
  8974.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8975.        ON so.object_id = si.object_id
  8976.        JOIN sys.schemas sc
  8977.        ON so.schema_id = sc.schema_id
  8978.        WHERE so.name = N'community_topic_image'  AND sc.name = N'dbo'  AND si.name = N'post_id_idx' AND so.type in (N'U'))
  8979.    DROP INDEX [post_id_idx] ON [dbo].[community_topic_image]
  8980. GO
  8981. CREATE NONCLUSTERED INDEX [post_id_idx] ON [dbo].[community_topic_image]
  8982. (
  8983.    [post_id] ASC
  8984. )
  8985. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  8986. GO
  8987. GO
  8988. IF  EXISTS (
  8989.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  8990.        ON so.object_id = si.object_id
  8991.        JOIN sys.schemas sc
  8992.        ON so.schema_id = sc.schema_id
  8993.        WHERE so.name = N'member_profile'  AND sc.name = N'dbo'  AND si.name = N'profile_id_idx' AND so.type in (N'U'))
  8994.    DROP INDEX [profile_id_idx] ON [dbo].[member_profile]
  8995. GO
  8996. CREATE NONCLUSTERED INDEX [profile_id_idx] ON [dbo].[member_profile]
  8997. (
  8998.    [profile_id] ASC
  8999. )
  9000. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  9001. GO
  9002. GO
  9003. IF  EXISTS (
  9004.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  9005.        ON so.object_id = si.object_id
  9006.        JOIN sys.schemas sc
  9007.        ON so.schema_id = sc.schema_id
  9008.        WHERE so.name = N'profile_option'  AND sc.name = N'dbo'  AND si.name = N'profile_id_idx' AND so.type in (N'U'))
  9009.    DROP INDEX [profile_id_idx] ON [dbo].[profile_option]
  9010. GO
  9011. CREATE NONCLUSTERED INDEX [profile_id_idx] ON [dbo].[profile_option]
  9012. (
  9013.    [profile_id] ASC
  9014. )
  9015. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  9016. GO
  9017. GO
  9018. IF  EXISTS (
  9019.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  9020.        ON so.object_id = si.object_id
  9021.        JOIN sys.schemas sc
  9022.        ON so.schema_id = sc.schema_id
  9023.        WHERE so.name = N'member_profile'  AND sc.name = N'dbo'  AND si.name = N'profile_option_id_idx' AND so.type in (N'U'))
  9024.    DROP INDEX [profile_option_id_idx] ON [dbo].[member_profile]
  9025. GO
  9026. CREATE NONCLUSTERED INDEX [profile_option_id_idx] ON [dbo].[member_profile]
  9027. (
  9028.    [profile_option_id] ASC
  9029. )
  9030. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  9031. GO
  9032. GO
  9033. IF  EXISTS (
  9034.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  9035.        ON so.object_id = si.object_id
  9036.        JOIN sys.schemas sc
  9037.        ON so.schema_id = sc.schema_id
  9038.        WHERE so.name = N'diary'  AND sc.name = N'dbo'  AND si.name = N'public_flag_craeted_at_idx' AND so.type in (N'U'))
  9039.    DROP INDEX [public_flag_craeted_at_idx] ON [dbo].[diary]
  9040. GO
  9041. CREATE NONCLUSTERED INDEX [public_flag_craeted_at_idx] ON [dbo].[diary]
  9042. (
  9043.    [public_flag] ASC,
  9044.    [created_at] ASC
  9045. )
  9046. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  9047. GO
  9048. GO
  9049. IF  EXISTS (
  9050.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  9051.        ON so.object_id = si.object_id
  9052.        JOIN sys.schemas sc
  9053.        ON so.schema_id = sc.schema_id
  9054.        WHERE so.name = N'gadget'  AND sc.name = N'dbo'  AND si.name = N'sort_order_INDEX_idx' AND so.type in (N'U'))
  9055.    DROP INDEX [sort_order_INDEX_idx] ON [dbo].[gadget]
  9056. GO
  9057. CREATE NONCLUSTERED INDEX [sort_order_INDEX_idx] ON [dbo].[gadget]
  9058. (
  9059.    [sort_order] ASC
  9060. )
  9061. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  9062. GO
  9063. GO
  9064. IF  EXISTS (
  9065.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  9066.        ON so.object_id = si.object_id
  9067.        JOIN sys.schemas sc
  9068.        ON so.schema_id = sc.schema_id
  9069.        WHERE so.name = N'application_invite'  AND sc.name = N'dbo'  AND si.name = N'to_member_id_idx' AND so.type in (N'U'))
  9070.    DROP INDEX [to_member_id_idx] ON [dbo].[application_invite]
  9071. GO
  9072. CREATE NONCLUSTERED INDEX [to_member_id_idx] ON [dbo].[application_invite]
  9073. (
  9074.    [to_member_id] ASC
  9075. )
  9076. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  9077. GO
  9078. GO
  9079. IF  EXISTS (
  9080.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  9081.        ON so.object_id = si.object_id
  9082.        JOIN sys.schemas sc
  9083.        ON so.schema_id = sc.schema_id
  9084.        WHERE so.name = N'navigation'  AND sc.name = N'dbo'  AND si.name = N'type_sort_order_INDEX_idx' AND so.type in (N'U'))
  9085.    DROP INDEX [type_sort_order_INDEX_idx] ON [dbo].[navigation]
  9086. GO
  9087. CREATE NONCLUSTERED INDEX [type_sort_order_INDEX_idx] ON [dbo].[navigation]
  9088. (
  9089.    [type] ASC,
  9090.    [sort_order] ASC
  9091. )
  9092. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  9093. GO
  9094. GO
  9095. IF  EXISTS (
  9096.        SELECT * FROM sys.objects  so JOIN sys.indexes si
  9097.        ON so.object_id = si.object_id
  9098.        JOIN sys.schemas sc
  9099.        ON so.schema_id = sc.schema_id
  9100.        WHERE so.name = N'openid_trust_log'  AND sc.name = N'dbo'  AND si.name = N'uri_key_INDEX_idx' AND so.type in (N'U'))
  9101.    DROP INDEX [uri_key_INDEX_idx] ON [dbo].[openid_trust_log]
  9102. GO
  9103. CREATE NONCLUSTERED INDEX [uri_key_INDEX_idx] ON [dbo].[openid_trust_log]
  9104. (
  9105.    [uri_key] ASC
  9106. )
  9107. WITH (DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
  9108. GO
  9109. GO
  9110. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'activity_data$activity_data_in_reply_to_activity_id_activity_data_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9111. ALTER TABLE [dbo].[activity_data] DROP CONSTRAINT [activity_data$activity_data_in_reply_to_activity_id_activity_data_id]
  9112.  GO
  9113.  
  9114.  
  9115.  
  9116. ALTER TABLE [dbo].[activity_data]
  9117.  ADD CONSTRAINT [activity_data$activity_data_in_reply_to_activity_id_activity_data_id]
  9118.  FOREIGN KEY
  9119.    ([in_reply_to_activity_id])
  9120.  REFERENCES
  9121.    [dbo].[activity_data]     ([id])
  9122.     ON DELETE NO ACTION
  9123.     ON UPDATE NO ACTION
  9124.  
  9125. GO
  9126.  
  9127. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'activity_data$activity_data_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9128. ALTER TABLE [dbo].[activity_data] DROP CONSTRAINT [activity_data$activity_data_member_id_member_id]
  9129.  GO
  9130.  
  9131.  
  9132.  
  9133. ALTER TABLE [dbo].[activity_data]
  9134.  ADD CONSTRAINT [activity_data$activity_data_member_id_member_id]
  9135.  FOREIGN KEY
  9136.    ([member_id])
  9137.  REFERENCES
  9138.    [dbo].[member]     ([id])
  9139.     ON DELETE NO ACTION
  9140.     ON UPDATE NO ACTION
  9141.  
  9142. GO
  9143.  
  9144. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'activity_image$activity_image_activity_data_id_activity_data_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9145. ALTER TABLE [dbo].[activity_image] DROP CONSTRAINT [activity_image$activity_image_activity_data_id_activity_data_id]
  9146.  GO
  9147.  
  9148.  
  9149.  
  9150. ALTER TABLE [dbo].[activity_image]
  9151.  ADD CONSTRAINT [activity_image$activity_image_activity_data_id_activity_data_id]
  9152.  FOREIGN KEY
  9153.    ([activity_data_id])
  9154.  REFERENCES
  9155.    [dbo].[activity_data]     ([id])
  9156.     ON DELETE NO ACTION
  9157.     ON UPDATE NO ACTION
  9158.  
  9159. GO
  9160.  
  9161. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'activity_image$activity_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9162. ALTER TABLE [dbo].[activity_image] DROP CONSTRAINT [activity_image$activity_image_file_id_file_id]
  9163.  GO
  9164.  
  9165.  
  9166.  
  9167. ALTER TABLE [dbo].[activity_image]
  9168.  ADD CONSTRAINT [activity_image$activity_image_file_id_file_id]
  9169.  FOREIGN KEY
  9170.    ([file_id])
  9171.  REFERENCES
  9172.    [dbo].[file]     ([id])
  9173.     ON DELETE NO ACTION
  9174.     ON UPDATE NO ACTION
  9175.  
  9176. GO
  9177.  
  9178. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'album$album_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9179. ALTER TABLE [dbo].[album] DROP CONSTRAINT [album$album_file_id_file_id]
  9180.  GO
  9181.  
  9182.  
  9183.  
  9184. ALTER TABLE [dbo].[album]
  9185.  ADD CONSTRAINT [album$album_file_id_file_id]
  9186.  FOREIGN KEY
  9187.    ([file_id])
  9188.  REFERENCES
  9189.    [dbo].[file]     ([id])
  9190.     ON DELETE NO ACTION
  9191.     ON UPDATE NO ACTION
  9192.  
  9193. GO
  9194.  
  9195. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'album$album_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9196. ALTER TABLE [dbo].[album] DROP CONSTRAINT [album$album_member_id_member_id]
  9197.  GO
  9198.  
  9199.  
  9200.  
  9201. ALTER TABLE [dbo].[album]
  9202.  ADD CONSTRAINT [album$album_member_id_member_id]
  9203.  FOREIGN KEY
  9204.    ([member_id])
  9205.  REFERENCES
  9206.    [dbo].[member]     ([id])
  9207.     ON DELETE NO ACTION
  9208.     ON UPDATE NO ACTION
  9209.  
  9210. GO
  9211.  
  9212. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'album_image$album_image_album_id_album_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9213. ALTER TABLE [dbo].[album_image] DROP CONSTRAINT [album_image$album_image_album_id_album_id]
  9214.  GO
  9215.  
  9216.  
  9217.  
  9218. ALTER TABLE [dbo].[album_image]
  9219.  ADD CONSTRAINT [album_image$album_image_album_id_album_id]
  9220.  FOREIGN KEY
  9221.    ([album_id])
  9222.  REFERENCES
  9223.    [dbo].[album]     ([id])
  9224.     ON DELETE NO ACTION
  9225.     ON UPDATE NO ACTION
  9226.  
  9227. GO
  9228.  
  9229. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'album_image$album_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9230. ALTER TABLE [dbo].[album_image] DROP CONSTRAINT [album_image$album_image_file_id_file_id]
  9231.  GO
  9232.  
  9233.  
  9234.  
  9235. ALTER TABLE [dbo].[album_image]
  9236.  ADD CONSTRAINT [album_image$album_image_file_id_file_id]
  9237.  FOREIGN KEY
  9238.    ([file_id])
  9239.  REFERENCES
  9240.    [dbo].[file]     ([id])
  9241.     ON DELETE NO ACTION
  9242.     ON UPDATE NO ACTION
  9243.  
  9244. GO
  9245.  
  9246. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'album_image$album_image_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9247. ALTER TABLE [dbo].[album_image] DROP CONSTRAINT [album_image$album_image_member_id_member_id]
  9248.  GO
  9249.  
  9250.  
  9251.  
  9252. ALTER TABLE [dbo].[album_image]
  9253.  ADD CONSTRAINT [album_image$album_image_member_id_member_id]
  9254.  FOREIGN KEY
  9255.    ([member_id])
  9256.  REFERENCES
  9257.    [dbo].[member]     ([id])
  9258.     ON DELETE NO ACTION
  9259.     ON UPDATE NO ACTION
  9260.  
  9261. GO
  9262.  
  9263. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application$application_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9264. ALTER TABLE [dbo].[application] DROP CONSTRAINT [application$application_member_id_member_id]
  9265.  GO
  9266.  
  9267.  
  9268.  
  9269. ALTER TABLE [dbo].[application]
  9270.  ADD CONSTRAINT [application$application_member_id_member_id]
  9271.  FOREIGN KEY
  9272.    ([member_id])
  9273.  REFERENCES
  9274.    [dbo].[member]     ([id])
  9275.     ON DELETE NO ACTION
  9276.     ON UPDATE NO ACTION
  9277.  
  9278. GO
  9279.  
  9280. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_invite$application_invite_application_id_application_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9281. ALTER TABLE [dbo].[application_invite] DROP CONSTRAINT [application_invite$application_invite_application_id_application_id]
  9282.  GO
  9283.  
  9284.  
  9285.  
  9286. ALTER TABLE [dbo].[application_invite]
  9287.  ADD CONSTRAINT [application_invite$application_invite_application_id_application_id]
  9288.  FOREIGN KEY
  9289.    ([application_id])
  9290.  REFERENCES
  9291.    [dbo].[application]     ([id])
  9292.     ON DELETE NO ACTION
  9293.     ON UPDATE NO ACTION
  9294.  
  9295. GO
  9296.  
  9297. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_invite$application_invite_from_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9298. ALTER TABLE [dbo].[application_invite] DROP CONSTRAINT [application_invite$application_invite_from_member_id_member_id]
  9299.  GO
  9300.  
  9301.  
  9302.  
  9303. ALTER TABLE [dbo].[application_invite]
  9304.  ADD CONSTRAINT [application_invite$application_invite_from_member_id_member_id]
  9305.  FOREIGN KEY
  9306.    ([from_member_id])
  9307.  REFERENCES
  9308.    [dbo].[member]     ([id])
  9309.     ON DELETE NO ACTION
  9310.     ON UPDATE NO ACTION
  9311.  
  9312. GO
  9313.  
  9314. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_invite$application_invite_to_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9315. ALTER TABLE [dbo].[application_invite] DROP CONSTRAINT [application_invite$application_invite_to_member_id_member_id]
  9316.  GO
  9317.  
  9318.  
  9319.  
  9320. ALTER TABLE [dbo].[application_invite]
  9321.  ADD CONSTRAINT [application_invite$application_invite_to_member_id_member_id]
  9322.  FOREIGN KEY
  9323.    ([to_member_id])
  9324.  REFERENCES
  9325.    [dbo].[member]     ([id])
  9326.     ON DELETE NO ACTION
  9327.     ON UPDATE NO ACTION
  9328.  
  9329. GO
  9330.  
  9331. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_lifecycle_event_queue$application_lifecycle_event_queue_application_id_application_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9332. ALTER TABLE [dbo].[application_lifecycle_event_queue] DROP CONSTRAINT [application_lifecycle_event_queue$application_lifecycle_event_queue_application_id_application_id]
  9333.  GO
  9334.  
  9335.  
  9336.  
  9337. ALTER TABLE [dbo].[application_lifecycle_event_queue]
  9338.  ADD CONSTRAINT [application_lifecycle_event_queue$application_lifecycle_event_queue_application_id_application_id]
  9339.  FOREIGN KEY
  9340.    ([application_id])
  9341.  REFERENCES
  9342.    [dbo].[application]     ([id])
  9343.     ON DELETE NO ACTION
  9344.     ON UPDATE NO ACTION
  9345.  
  9346. GO
  9347.  
  9348. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_lifecycle_event_queue$application_lifecycle_event_queue_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9349. ALTER TABLE [dbo].[application_lifecycle_event_queue] DROP CONSTRAINT [application_lifecycle_event_queue$application_lifecycle_event_queue_member_id_member_id]
  9350.  GO
  9351.  
  9352.  
  9353.  
  9354. ALTER TABLE [dbo].[application_lifecycle_event_queue]
  9355.  ADD CONSTRAINT [application_lifecycle_event_queue$application_lifecycle_event_queue_member_id_member_id]
  9356.  FOREIGN KEY
  9357.    ([member_id])
  9358.  REFERENCES
  9359.    [dbo].[member]     ([id])
  9360.     ON DELETE NO ACTION
  9361.     ON UPDATE NO ACTION
  9362.  
  9363. GO
  9364.  
  9365. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_persistent_data$application_persistent_data_application_id_application_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9366. ALTER TABLE [dbo].[application_persistent_data] DROP CONSTRAINT [application_persistent_data$application_persistent_data_application_id_application_id]
  9367.  GO
  9368.  
  9369.  
  9370.  
  9371. ALTER TABLE [dbo].[application_persistent_data]
  9372.  ADD CONSTRAINT [application_persistent_data$application_persistent_data_application_id_application_id]
  9373.  FOREIGN KEY
  9374.    ([application_id])
  9375.  REFERENCES
  9376.    [dbo].[application]     ([id])
  9377.     ON DELETE NO ACTION
  9378.     ON UPDATE NO ACTION
  9379.  
  9380. GO
  9381.  
  9382. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_persistent_data$application_persistent_data_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9383. ALTER TABLE [dbo].[application_persistent_data] DROP CONSTRAINT [application_persistent_data$application_persistent_data_member_id_member_id]
  9384.  GO
  9385.  
  9386.  
  9387.  
  9388. ALTER TABLE [dbo].[application_persistent_data]
  9389.  ADD CONSTRAINT [application_persistent_data$application_persistent_data_member_id_member_id]
  9390.  FOREIGN KEY
  9391.    ([member_id])
  9392.  REFERENCES
  9393.    [dbo].[member]     ([id])
  9394.     ON DELETE NO ACTION
  9395.     ON UPDATE NO ACTION
  9396.  
  9397. GO
  9398.  
  9399. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'application_translation$application_translation_id_application_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9400. ALTER TABLE [dbo].[application_translation] DROP CONSTRAINT [application_translation$application_translation_id_application_id]
  9401.  GO
  9402.  
  9403.  
  9404.  
  9405. ALTER TABLE [dbo].[application_translation]
  9406.  ADD CONSTRAINT [application_translation$application_translation_id_application_id]
  9407.  FOREIGN KEY
  9408.    ([id])
  9409.  REFERENCES
  9410.    [dbo].[application]     ([id])
  9411.     ON DELETE NO ACTION
  9412.     ON UPDATE CASCADE
  9413.  
  9414. GO
  9415.  
  9416. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'ashiato$ashiato_member_id_from_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9417. ALTER TABLE [dbo].[ashiato] DROP CONSTRAINT [ashiato$ashiato_member_id_from_member_id]
  9418.  GO
  9419.  
  9420.  
  9421.  
  9422. ALTER TABLE [dbo].[ashiato]
  9423.  ADD CONSTRAINT [ashiato$ashiato_member_id_from_member_id]
  9424.  FOREIGN KEY
  9425.    ([member_id_from])
  9426.  REFERENCES
  9427.    [dbo].[member]     ([id])
  9428.     ON DELETE NO ACTION
  9429.     ON UPDATE NO ACTION
  9430.  
  9431. GO
  9432.  
  9433. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'ashiato$ashiato_member_id_to_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9434. ALTER TABLE [dbo].[ashiato] DROP CONSTRAINT [ashiato$ashiato_member_id_to_member_id]
  9435.  GO
  9436.  
  9437.  
  9438.  
  9439. ALTER TABLE [dbo].[ashiato]
  9440.  ADD CONSTRAINT [ashiato$ashiato_member_id_to_member_id]
  9441.  FOREIGN KEY
  9442.    ([member_id_to])
  9443.  REFERENCES
  9444.    [dbo].[member]     ([id])
  9445.     ON DELETE NO ACTION
  9446.     ON UPDATE NO ACTION
  9447.  
  9448. GO
  9449.  
  9450. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner_image$banner_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9451. ALTER TABLE [dbo].[banner_image] DROP CONSTRAINT [banner_image$banner_image_file_id_file_id]
  9452.  GO
  9453.  
  9454.  
  9455.  
  9456. ALTER TABLE [dbo].[banner_image]
  9457.  ADD CONSTRAINT [banner_image$banner_image_file_id_file_id]
  9458.  FOREIGN KEY
  9459.    ([file_id])
  9460.  REFERENCES
  9461.    [dbo].[file]     ([id])
  9462.     ON DELETE NO ACTION
  9463.     ON UPDATE NO ACTION
  9464.  
  9465. GO
  9466.  
  9467. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner_translation$banner_translation_id_banner_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9468. ALTER TABLE [dbo].[banner_translation] DROP CONSTRAINT [banner_translation$banner_translation_id_banner_id]
  9469.  GO
  9470.  
  9471.  
  9472.  
  9473. ALTER TABLE [dbo].[banner_translation]
  9474.  ADD CONSTRAINT [banner_translation$banner_translation_id_banner_id]
  9475.  FOREIGN KEY
  9476.    ([id])
  9477.  REFERENCES
  9478.    [dbo].[banner]     ([id])
  9479.     ON DELETE NO ACTION
  9480.     ON UPDATE CASCADE
  9481.  
  9482. GO
  9483.  
  9484. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner_use_image$banner_use_image_banner_id_banner_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9485. ALTER TABLE [dbo].[banner_use_image] DROP CONSTRAINT [banner_use_image$banner_use_image_banner_id_banner_id]
  9486.  GO
  9487.  
  9488.  
  9489.  
  9490. ALTER TABLE [dbo].[banner_use_image]
  9491.  ADD CONSTRAINT [banner_use_image$banner_use_image_banner_id_banner_id]
  9492.  FOREIGN KEY
  9493.    ([banner_id])
  9494.  REFERENCES
  9495.    [dbo].[banner]     ([id])
  9496.     ON DELETE NO ACTION
  9497.     ON UPDATE NO ACTION
  9498.  
  9499. GO
  9500.  
  9501. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'banner_use_image$banner_use_image_banner_image_id_banner_image_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9502. ALTER TABLE [dbo].[banner_use_image] DROP CONSTRAINT [banner_use_image$banner_use_image_banner_image_id_banner_image_id]
  9503.  GO
  9504.  
  9505.  
  9506.  
  9507. ALTER TABLE [dbo].[banner_use_image]
  9508.  ADD CONSTRAINT [banner_use_image$banner_use_image_banner_image_id_banner_image_id]
  9509.  FOREIGN KEY
  9510.    ([banner_image_id])
  9511.  REFERENCES
  9512.    [dbo].[banner_image]     ([id])
  9513.     ON DELETE NO ACTION
  9514.     ON UPDATE NO ACTION
  9515.  
  9516. GO
  9517.  
  9518. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'blog_rss_cache$blog_rss_cache_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9519. ALTER TABLE [dbo].[blog_rss_cache] DROP CONSTRAINT [blog_rss_cache$blog_rss_cache_member_id_member_id]
  9520.  GO
  9521.  
  9522.  
  9523.  
  9524. ALTER TABLE [dbo].[blog_rss_cache]
  9525.  ADD CONSTRAINT [blog_rss_cache$blog_rss_cache_member_id_member_id]
  9526.  FOREIGN KEY
  9527.    ([member_id])
  9528.  REFERENCES
  9529.    [dbo].[member]     ([id])
  9530.     ON DELETE NO ACTION
  9531.     ON UPDATE NO ACTION
  9532.  
  9533. GO
  9534.  
  9535. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community$community_community_category_id_community_category_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9536. ALTER TABLE [dbo].[community] DROP CONSTRAINT [community$community_community_category_id_community_category_id]
  9537.  GO
  9538.  
  9539.  
  9540.  
  9541. ALTER TABLE [dbo].[community]
  9542.  ADD CONSTRAINT [community$community_community_category_id_community_category_id]
  9543.  FOREIGN KEY
  9544.    ([community_category_id])
  9545.  REFERENCES
  9546.    [dbo].[community_category]     ([id])
  9547.     ON DELETE NO ACTION
  9548.     ON UPDATE NO ACTION
  9549.  
  9550. GO
  9551.  
  9552. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community$community_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9553. ALTER TABLE [dbo].[community] DROP CONSTRAINT [community$community_file_id_file_id]
  9554.  GO
  9555.  
  9556.  
  9557.  
  9558. ALTER TABLE [dbo].[community]
  9559.  ADD CONSTRAINT [community$community_file_id_file_id]
  9560.  FOREIGN KEY
  9561.    ([file_id])
  9562.  REFERENCES
  9563.    [dbo].[file]     ([id])
  9564.     ON DELETE NO ACTION
  9565.     ON UPDATE NO ACTION
  9566.  
  9567. GO
  9568.  
  9569. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_config$community_config_community_id_community_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9570. ALTER TABLE [dbo].[community_config] DROP CONSTRAINT [community_config$community_config_community_id_community_id]
  9571.  GO
  9572.  
  9573.  
  9574.  
  9575. ALTER TABLE [dbo].[community_config]
  9576.  ADD CONSTRAINT [community_config$community_config_community_id_community_id]
  9577.  FOREIGN KEY
  9578.    ([community_id])
  9579.  REFERENCES
  9580.    [dbo].[community]     ([id])
  9581.     ON DELETE NO ACTION
  9582.     ON UPDATE NO ACTION
  9583.  
  9584. GO
  9585.  
  9586. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event$community_event_community_id_community_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9587. ALTER TABLE [dbo].[community_event] DROP CONSTRAINT [community_event$community_event_community_id_community_id]
  9588.  GO
  9589.  
  9590.  
  9591.  
  9592. ALTER TABLE [dbo].[community_event]
  9593.  ADD CONSTRAINT [community_event$community_event_community_id_community_id]
  9594.  FOREIGN KEY
  9595.    ([community_id])
  9596.  REFERENCES
  9597.    [dbo].[community]     ([id])
  9598.     ON DELETE NO ACTION
  9599.     ON UPDATE NO ACTION
  9600.  
  9601. GO
  9602.  
  9603. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event$community_event_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9604. ALTER TABLE [dbo].[community_event] DROP CONSTRAINT [community_event$community_event_member_id_member_id]
  9605.  GO
  9606.  
  9607.  
  9608.  
  9609. ALTER TABLE [dbo].[community_event]
  9610.  ADD CONSTRAINT [community_event$community_event_member_id_member_id]
  9611.  FOREIGN KEY
  9612.    ([member_id])
  9613.  REFERENCES
  9614.    [dbo].[member]     ([id])
  9615.     ON DELETE NO ACTION
  9616.     ON UPDATE NO ACTION
  9617.  
  9618. GO
  9619.  
  9620. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_comment$community_event_comment_community_event_id_community_event_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9621. ALTER TABLE [dbo].[community_event_comment] DROP CONSTRAINT [community_event_comment$community_event_comment_community_event_id_community_event_id]
  9622.  GO
  9623.  
  9624.  
  9625.  
  9626. ALTER TABLE [dbo].[community_event_comment]
  9627.  ADD CONSTRAINT [community_event_comment$community_event_comment_community_event_id_community_event_id]
  9628.  FOREIGN KEY
  9629.    ([community_event_id])
  9630.  REFERENCES
  9631.    [dbo].[community_event]     ([id])
  9632.     ON DELETE NO ACTION
  9633.     ON UPDATE NO ACTION
  9634.  
  9635. GO
  9636.  
  9637. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_comment$community_event_comment_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9638. ALTER TABLE [dbo].[community_event_comment] DROP CONSTRAINT [community_event_comment$community_event_comment_member_id_member_id]
  9639.  GO
  9640.  
  9641.  
  9642.  
  9643. ALTER TABLE [dbo].[community_event_comment]
  9644.  ADD CONSTRAINT [community_event_comment$community_event_comment_member_id_member_id]
  9645.  FOREIGN KEY
  9646.    ([member_id])
  9647.  REFERENCES
  9648.    [dbo].[member]     ([id])
  9649.     ON DELETE NO ACTION
  9650.     ON UPDATE NO ACTION
  9651.  
  9652. GO
  9653.  
  9654. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_comment_image$community_event_comment_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9655. ALTER TABLE [dbo].[community_event_comment_image] DROP CONSTRAINT [community_event_comment_image$community_event_comment_image_file_id_file_id]
  9656.  GO
  9657.  
  9658.  
  9659.  
  9660. ALTER TABLE [dbo].[community_event_comment_image]
  9661.  ADD CONSTRAINT [community_event_comment_image$community_event_comment_image_file_id_file_id]
  9662.  FOREIGN KEY
  9663.    ([file_id])
  9664.  REFERENCES
  9665.    [dbo].[file]     ([id])
  9666.     ON DELETE NO ACTION
  9667.     ON UPDATE NO ACTION
  9668.  
  9669. GO
  9670.  
  9671. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_comment_image$community_event_comment_image_post_id_community_event_comment_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9672. ALTER TABLE [dbo].[community_event_comment_image] DROP CONSTRAINT [community_event_comment_image$community_event_comment_image_post_id_community_event_comment_id]
  9673.  GO
  9674.  
  9675.  
  9676.  
  9677. ALTER TABLE [dbo].[community_event_comment_image]
  9678.  ADD CONSTRAINT [community_event_comment_image$community_event_comment_image_post_id_community_event_comment_id]
  9679.  FOREIGN KEY
  9680.    ([post_id])
  9681.  REFERENCES
  9682.    [dbo].[community_event_comment]     ([id])
  9683.     ON DELETE NO ACTION
  9684.     ON UPDATE NO ACTION
  9685.  
  9686. GO
  9687.  
  9688. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_image$community_event_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9689. ALTER TABLE [dbo].[community_event_image] DROP CONSTRAINT [community_event_image$community_event_image_file_id_file_id]
  9690.  GO
  9691.  
  9692.  
  9693.  
  9694. ALTER TABLE [dbo].[community_event_image]
  9695.  ADD CONSTRAINT [community_event_image$community_event_image_file_id_file_id]
  9696.  FOREIGN KEY
  9697.    ([file_id])
  9698.  REFERENCES
  9699.    [dbo].[file]     ([id])
  9700.     ON DELETE NO ACTION
  9701.     ON UPDATE NO ACTION
  9702.  
  9703. GO
  9704.  
  9705. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_image$community_event_image_post_id_community_event_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9706. ALTER TABLE [dbo].[community_event_image] DROP CONSTRAINT [community_event_image$community_event_image_post_id_community_event_id]
  9707.  GO
  9708.  
  9709.  
  9710.  
  9711. ALTER TABLE [dbo].[community_event_image]
  9712.  ADD CONSTRAINT [community_event_image$community_event_image_post_id_community_event_id]
  9713.  FOREIGN KEY
  9714.    ([post_id])
  9715.  REFERENCES
  9716.    [dbo].[community_event]     ([id])
  9717.     ON DELETE NO ACTION
  9718.     ON UPDATE NO ACTION
  9719.  
  9720. GO
  9721.  
  9722. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_member$community_event_member_community_event_id_community_event_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9723. ALTER TABLE [dbo].[community_event_member] DROP CONSTRAINT [community_event_member$community_event_member_community_event_id_community_event_id]
  9724.  GO
  9725.  
  9726.  
  9727.  
  9728. ALTER TABLE [dbo].[community_event_member]
  9729.  ADD CONSTRAINT [community_event_member$community_event_member_community_event_id_community_event_id]
  9730.  FOREIGN KEY
  9731.    ([community_event_id])
  9732.  REFERENCES
  9733.    [dbo].[community_event]     ([id])
  9734.     ON DELETE NO ACTION
  9735.     ON UPDATE NO ACTION
  9736.  
  9737. GO
  9738.  
  9739. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_event_member$community_event_member_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9740. ALTER TABLE [dbo].[community_event_member] DROP CONSTRAINT [community_event_member$community_event_member_member_id_member_id]
  9741.  GO
  9742.  
  9743.  
  9744.  
  9745. ALTER TABLE [dbo].[community_event_member]
  9746.  ADD CONSTRAINT [community_event_member$community_event_member_member_id_member_id]
  9747.  FOREIGN KEY
  9748.    ([member_id])
  9749.  REFERENCES
  9750.    [dbo].[member]     ([id])
  9751.     ON DELETE NO ACTION
  9752.     ON UPDATE NO ACTION
  9753.  
  9754. GO
  9755.  
  9756. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_member$community_member_community_id_community_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9757. ALTER TABLE [dbo].[community_member] DROP CONSTRAINT [community_member$community_member_community_id_community_id]
  9758.  GO
  9759.  
  9760.  
  9761.  
  9762. ALTER TABLE [dbo].[community_member]
  9763.  ADD CONSTRAINT [community_member$community_member_community_id_community_id]
  9764.  FOREIGN KEY
  9765.    ([community_id])
  9766.  REFERENCES
  9767.    [dbo].[community]     ([id])
  9768.     ON DELETE NO ACTION
  9769.     ON UPDATE NO ACTION
  9770.  
  9771. GO
  9772.  
  9773. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_member$community_member_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9774. ALTER TABLE [dbo].[community_member] DROP CONSTRAINT [community_member$community_member_member_id_member_id]
  9775.  GO
  9776.  
  9777.  
  9778.  
  9779. ALTER TABLE [dbo].[community_member]
  9780.  ADD CONSTRAINT [community_member$community_member_member_id_member_id]
  9781.  FOREIGN KEY
  9782.    ([member_id])
  9783.  REFERENCES
  9784.    [dbo].[member]     ([id])
  9785.     ON DELETE NO ACTION
  9786.     ON UPDATE NO ACTION
  9787.  
  9788. GO
  9789.  
  9790. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_member_position$ccci'  AND sc.name=N'dbo'  AND type in (N'F'))
  9791. ALTER TABLE [dbo].[community_member_position] DROP CONSTRAINT [community_member_position$ccci]
  9792.  GO
  9793.  
  9794.  
  9795.  
  9796. ALTER TABLE [dbo].[community_member_position]
  9797.  ADD CONSTRAINT [community_member_position$ccci]
  9798.  FOREIGN KEY
  9799.    ([community_member_id])
  9800.  REFERENCES
  9801.    [dbo].[community_member]     ([id])
  9802.     ON DELETE NO ACTION
  9803.     ON UPDATE NO ACTION
  9804.  
  9805. GO
  9806.  
  9807. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_member_position$community_member_position_community_id_community_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9808. ALTER TABLE [dbo].[community_member_position] DROP CONSTRAINT [community_member_position$community_member_position_community_id_community_id]
  9809.  GO
  9810.  
  9811.  
  9812.  
  9813. ALTER TABLE [dbo].[community_member_position]
  9814.  ADD CONSTRAINT [community_member_position$community_member_position_community_id_community_id]
  9815.  FOREIGN KEY
  9816.    ([community_id])
  9817.  REFERENCES
  9818.    [dbo].[community]     ([id])
  9819.     ON DELETE NO ACTION
  9820.     ON UPDATE NO ACTION
  9821.  
  9822. GO
  9823.  
  9824. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_member_position$community_member_position_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9825. ALTER TABLE [dbo].[community_member_position] DROP CONSTRAINT [community_member_position$community_member_position_member_id_member_id]
  9826.  GO
  9827.  
  9828.  
  9829.  
  9830. ALTER TABLE [dbo].[community_member_position]
  9831.  ADD CONSTRAINT [community_member_position$community_member_position_member_id_member_id]
  9832.  FOREIGN KEY
  9833.    ([member_id])
  9834.  REFERENCES
  9835.    [dbo].[member]     ([id])
  9836.     ON DELETE NO ACTION
  9837.     ON UPDATE NO ACTION
  9838.  
  9839. GO
  9840.  
  9841. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic$community_topic_community_id_community_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9842. ALTER TABLE [dbo].[community_topic] DROP CONSTRAINT [community_topic$community_topic_community_id_community_id]
  9843.  GO
  9844.  
  9845.  
  9846.  
  9847. ALTER TABLE [dbo].[community_topic]
  9848.  ADD CONSTRAINT [community_topic$community_topic_community_id_community_id]
  9849.  FOREIGN KEY
  9850.    ([community_id])
  9851.  REFERENCES
  9852.    [dbo].[community]     ([id])
  9853.     ON DELETE NO ACTION
  9854.     ON UPDATE NO ACTION
  9855.  
  9856. GO
  9857.  
  9858. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic$community_topic_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9859. ALTER TABLE [dbo].[community_topic] DROP CONSTRAINT [community_topic$community_topic_member_id_member_id]
  9860.  GO
  9861.  
  9862.  
  9863.  
  9864. ALTER TABLE [dbo].[community_topic]
  9865.  ADD CONSTRAINT [community_topic$community_topic_member_id_member_id]
  9866.  FOREIGN KEY
  9867.    ([member_id])
  9868.  REFERENCES
  9869.    [dbo].[member]     ([id])
  9870.     ON DELETE NO ACTION
  9871.     ON UPDATE NO ACTION
  9872.  
  9873. GO
  9874.  
  9875. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_comment$community_topic_comment_community_topic_id_community_topic_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9876. ALTER TABLE [dbo].[community_topic_comment] DROP CONSTRAINT [community_topic_comment$community_topic_comment_community_topic_id_community_topic_id]
  9877.  GO
  9878.  
  9879.  
  9880.  
  9881. ALTER TABLE [dbo].[community_topic_comment]
  9882.  ADD CONSTRAINT [community_topic_comment$community_topic_comment_community_topic_id_community_topic_id]
  9883.  FOREIGN KEY
  9884.    ([community_topic_id])
  9885.  REFERENCES
  9886.    [dbo].[community_topic]     ([id])
  9887.     ON DELETE NO ACTION
  9888.     ON UPDATE NO ACTION
  9889.  
  9890. GO
  9891.  
  9892. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_comment$community_topic_comment_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9893. ALTER TABLE [dbo].[community_topic_comment] DROP CONSTRAINT [community_topic_comment$community_topic_comment_member_id_member_id]
  9894.  GO
  9895.  
  9896.  
  9897.  
  9898. ALTER TABLE [dbo].[community_topic_comment]
  9899.  ADD CONSTRAINT [community_topic_comment$community_topic_comment_member_id_member_id]
  9900.  FOREIGN KEY
  9901.    ([member_id])
  9902.  REFERENCES
  9903.    [dbo].[member]     ([id])
  9904.     ON DELETE NO ACTION
  9905.     ON UPDATE NO ACTION
  9906.  
  9907. GO
  9908.  
  9909. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_comment_image$community_topic_comment_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9910. ALTER TABLE [dbo].[community_topic_comment_image] DROP CONSTRAINT [community_topic_comment_image$community_topic_comment_image_file_id_file_id]
  9911.  GO
  9912.  
  9913.  
  9914.  
  9915. ALTER TABLE [dbo].[community_topic_comment_image]
  9916.  ADD CONSTRAINT [community_topic_comment_image$community_topic_comment_image_file_id_file_id]
  9917.  FOREIGN KEY
  9918.    ([file_id])
  9919.  REFERENCES
  9920.    [dbo].[file]     ([id])
  9921.     ON DELETE NO ACTION
  9922.     ON UPDATE NO ACTION
  9923.  
  9924. GO
  9925.  
  9926. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_comment_image$community_topic_comment_image_post_id_community_topic_comment_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9927. ALTER TABLE [dbo].[community_topic_comment_image] DROP CONSTRAINT [community_topic_comment_image$community_topic_comment_image_post_id_community_topic_comment_id]
  9928.  GO
  9929.  
  9930.  
  9931.  
  9932. ALTER TABLE [dbo].[community_topic_comment_image]
  9933.  ADD CONSTRAINT [community_topic_comment_image$community_topic_comment_image_post_id_community_topic_comment_id]
  9934.  FOREIGN KEY
  9935.    ([post_id])
  9936.  REFERENCES
  9937.    [dbo].[community_topic_comment]     ([id])
  9938.     ON DELETE NO ACTION
  9939.     ON UPDATE NO ACTION
  9940.  
  9941. GO
  9942.  
  9943. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_image$community_topic_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9944. ALTER TABLE [dbo].[community_topic_image] DROP CONSTRAINT [community_topic_image$community_topic_image_file_id_file_id]
  9945.  GO
  9946.  
  9947.  
  9948.  
  9949. ALTER TABLE [dbo].[community_topic_image]
  9950.  ADD CONSTRAINT [community_topic_image$community_topic_image_file_id_file_id]
  9951.  FOREIGN KEY
  9952.    ([file_id])
  9953.  REFERENCES
  9954.    [dbo].[file]     ([id])
  9955.     ON DELETE NO ACTION
  9956.     ON UPDATE NO ACTION
  9957.  
  9958. GO
  9959.  
  9960. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'community_topic_image$community_topic_image_post_id_community_topic_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9961. ALTER TABLE [dbo].[community_topic_image] DROP CONSTRAINT [community_topic_image$community_topic_image_post_id_community_topic_id]
  9962.  GO
  9963.  
  9964.  
  9965.  
  9966. ALTER TABLE [dbo].[community_topic_image]
  9967.  ADD CONSTRAINT [community_topic_image$community_topic_image_post_id_community_topic_id]
  9968.  FOREIGN KEY
  9969.    ([post_id])
  9970.  REFERENCES
  9971.    [dbo].[community_topic]     ([id])
  9972.     ON DELETE NO ACTION
  9973.     ON UPDATE NO ACTION
  9974.  
  9975. GO
  9976.  
  9977. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'deleted_message$deleted_message_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9978. ALTER TABLE [dbo].[deleted_message] DROP CONSTRAINT [deleted_message$deleted_message_member_id_member_id]
  9979.  GO
  9980.  
  9981.  
  9982.  
  9983. ALTER TABLE [dbo].[deleted_message]
  9984.  ADD CONSTRAINT [deleted_message$deleted_message_member_id_member_id]
  9985.  FOREIGN KEY
  9986.    ([member_id])
  9987.  REFERENCES
  9988.    [dbo].[member]     ([id])
  9989.     ON DELETE NO ACTION
  9990.     ON UPDATE NO ACTION
  9991.  
  9992. GO
  9993.  
  9994. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary$diary_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  9995. ALTER TABLE [dbo].[diary] DROP CONSTRAINT [diary$diary_member_id_member_id]
  9996.  GO
  9997.  
  9998.  
  9999.  
  10000. ALTER TABLE [dbo].[diary]
  10001.  ADD CONSTRAINT [diary$diary_member_id_member_id]
  10002.  FOREIGN KEY
  10003.    ([member_id])
  10004.  REFERENCES
  10005.    [dbo].[member]     ([id])
  10006.     ON DELETE NO ACTION
  10007.     ON UPDATE NO ACTION
  10008.  
  10009. GO
  10010.  
  10011. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment$diary_comment_diary_id_diary_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10012. ALTER TABLE [dbo].[diary_comment] DROP CONSTRAINT [diary_comment$diary_comment_diary_id_diary_id]
  10013.  GO
  10014.  
  10015.  
  10016.  
  10017. ALTER TABLE [dbo].[diary_comment]
  10018.  ADD CONSTRAINT [diary_comment$diary_comment_diary_id_diary_id]
  10019.  FOREIGN KEY
  10020.    ([diary_id])
  10021.  REFERENCES
  10022.    [dbo].[diary]     ([id])
  10023.     ON DELETE NO ACTION
  10024.     ON UPDATE NO ACTION
  10025.  
  10026. GO
  10027.  
  10028. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment$diary_comment_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10029. ALTER TABLE [dbo].[diary_comment] DROP CONSTRAINT [diary_comment$diary_comment_member_id_member_id]
  10030.  GO
  10031.  
  10032.  
  10033.  
  10034. ALTER TABLE [dbo].[diary_comment]
  10035.  ADD CONSTRAINT [diary_comment$diary_comment_member_id_member_id]
  10036.  FOREIGN KEY
  10037.    ([member_id])
  10038.  REFERENCES
  10039.    [dbo].[member]     ([id])
  10040.     ON DELETE NO ACTION
  10041.     ON UPDATE NO ACTION
  10042.  
  10043. GO
  10044.  
  10045. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_image$diary_comment_image_diary_comment_id_diary_comment_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10046. ALTER TABLE [dbo].[diary_comment_image] DROP CONSTRAINT [diary_comment_image$diary_comment_image_diary_comment_id_diary_comment_id]
  10047.  GO
  10048.  
  10049.  
  10050.  
  10051. ALTER TABLE [dbo].[diary_comment_image]
  10052.  ADD CONSTRAINT [diary_comment_image$diary_comment_image_diary_comment_id_diary_comment_id]
  10053.  FOREIGN KEY
  10054.    ([diary_comment_id])
  10055.  REFERENCES
  10056.    [dbo].[diary_comment]     ([id])
  10057.     ON DELETE NO ACTION
  10058.     ON UPDATE NO ACTION
  10059.  
  10060. GO
  10061.  
  10062. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_image$diary_comment_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10063. ALTER TABLE [dbo].[diary_comment_image] DROP CONSTRAINT [diary_comment_image$diary_comment_image_file_id_file_id]
  10064.  GO
  10065.  
  10066.  
  10067.  
  10068. ALTER TABLE [dbo].[diary_comment_image]
  10069.  ADD CONSTRAINT [diary_comment_image$diary_comment_image_file_id_file_id]
  10070.  FOREIGN KEY
  10071.    ([file_id])
  10072.  REFERENCES
  10073.    [dbo].[file]     ([id])
  10074.     ON DELETE NO ACTION
  10075.     ON UPDATE NO ACTION
  10076.  
  10077. GO
  10078.  
  10079. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_unread$diary_comment_unread_diary_id_diary_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10080. ALTER TABLE [dbo].[diary_comment_unread] DROP CONSTRAINT [diary_comment_unread$diary_comment_unread_diary_id_diary_id]
  10081.  GO
  10082.  
  10083.  
  10084.  
  10085. ALTER TABLE [dbo].[diary_comment_unread]
  10086.  ADD CONSTRAINT [diary_comment_unread$diary_comment_unread_diary_id_diary_id]
  10087.  FOREIGN KEY
  10088.    ([diary_id])
  10089.  REFERENCES
  10090.    [dbo].[diary]     ([id])
  10091.     ON DELETE NO ACTION
  10092.     ON UPDATE NO ACTION
  10093.  
  10094. GO
  10095.  
  10096. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_unread$diary_comment_unread_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10097. ALTER TABLE [dbo].[diary_comment_unread] DROP CONSTRAINT [diary_comment_unread$diary_comment_unread_member_id_member_id]
  10098.  GO
  10099.  
  10100.  
  10101.  
  10102. ALTER TABLE [dbo].[diary_comment_unread]
  10103.  ADD CONSTRAINT [diary_comment_unread$diary_comment_unread_member_id_member_id]
  10104.  FOREIGN KEY
  10105.    ([member_id])
  10106.  REFERENCES
  10107.    [dbo].[member]     ([id])
  10108.     ON DELETE NO ACTION
  10109.     ON UPDATE NO ACTION
  10110.  
  10111. GO
  10112.  
  10113. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_update$diary_comment_update_diary_id_diary_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10114. ALTER TABLE [dbo].[diary_comment_update] DROP CONSTRAINT [diary_comment_update$diary_comment_update_diary_id_diary_id]
  10115.  GO
  10116.  
  10117.  
  10118.  
  10119. ALTER TABLE [dbo].[diary_comment_update]
  10120.  ADD CONSTRAINT [diary_comment_update$diary_comment_update_diary_id_diary_id]
  10121.  FOREIGN KEY
  10122.    ([diary_id])
  10123.  REFERENCES
  10124.    [dbo].[diary]     ([id])
  10125.     ON DELETE NO ACTION
  10126.     ON UPDATE NO ACTION
  10127.  
  10128. GO
  10129.  
  10130. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_comment_update$diary_comment_update_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10131. ALTER TABLE [dbo].[diary_comment_update] DROP CONSTRAINT [diary_comment_update$diary_comment_update_member_id_member_id]
  10132.  GO
  10133.  
  10134.  
  10135.  
  10136. ALTER TABLE [dbo].[diary_comment_update]
  10137.  ADD CONSTRAINT [diary_comment_update$diary_comment_update_member_id_member_id]
  10138.  FOREIGN KEY
  10139.    ([member_id])
  10140.  REFERENCES
  10141.    [dbo].[member]     ([id])
  10142.     ON DELETE NO ACTION
  10143.     ON UPDATE NO ACTION
  10144.  
  10145. GO
  10146.  
  10147. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_image$diary_image_diary_id_diary_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10148. ALTER TABLE [dbo].[diary_image] DROP CONSTRAINT [diary_image$diary_image_diary_id_diary_id]
  10149.  GO
  10150.  
  10151.  
  10152.  
  10153. ALTER TABLE [dbo].[diary_image]
  10154.  ADD CONSTRAINT [diary_image$diary_image_diary_id_diary_id]
  10155.  FOREIGN KEY
  10156.    ([diary_id])
  10157.  REFERENCES
  10158.    [dbo].[diary]     ([id])
  10159.     ON DELETE NO ACTION
  10160.     ON UPDATE NO ACTION
  10161.  
  10162. GO
  10163.  
  10164. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'diary_image$diary_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10165. ALTER TABLE [dbo].[diary_image] DROP CONSTRAINT [diary_image$diary_image_file_id_file_id]
  10166.  GO
  10167.  
  10168.  
  10169.  
  10170. ALTER TABLE [dbo].[diary_image]
  10171.  ADD CONSTRAINT [diary_image$diary_image_file_id_file_id]
  10172.  FOREIGN KEY
  10173.    ([file_id])
  10174.  REFERENCES
  10175.    [dbo].[file]     ([id])
  10176.     ON DELETE NO ACTION
  10177.     ON UPDATE NO ACTION
  10178.  
  10179. GO
  10180.  
  10181. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'favorite$favorite_member_id_from_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10182. ALTER TABLE [dbo].[favorite] DROP CONSTRAINT [favorite$favorite_member_id_from_member_id]
  10183.  GO
  10184.  
  10185.  
  10186.  
  10187. ALTER TABLE [dbo].[favorite]
  10188.  ADD CONSTRAINT [favorite$favorite_member_id_from_member_id]
  10189.  FOREIGN KEY
  10190.    ([member_id_from])
  10191.  REFERENCES
  10192.    [dbo].[member]     ([id])
  10193.     ON DELETE NO ACTION
  10194.     ON UPDATE NO ACTION
  10195.  
  10196. GO
  10197.  
  10198. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'favorite$favorite_member_id_to_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10199. ALTER TABLE [dbo].[favorite] DROP CONSTRAINT [favorite$favorite_member_id_to_member_id]
  10200.  GO
  10201.  
  10202.  
  10203.  
  10204. ALTER TABLE [dbo].[favorite]
  10205.  ADD CONSTRAINT [favorite$favorite_member_id_to_member_id]
  10206.  FOREIGN KEY
  10207.    ([member_id_to])
  10208.  REFERENCES
  10209.    [dbo].[member]     ([id])
  10210.     ON DELETE NO ACTION
  10211.     ON UPDATE NO ACTION
  10212.  
  10213. GO
  10214.  
  10215. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'file_bin$file_bin_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10216. ALTER TABLE [dbo].[file_bin] DROP CONSTRAINT [file_bin$file_bin_file_id_file_id]
  10217.  GO
  10218.  
  10219.  
  10220.  
  10221. ALTER TABLE [dbo].[file_bin]
  10222.  ADD CONSTRAINT [file_bin$file_bin_file_id_file_id]
  10223.  FOREIGN KEY
  10224.    ([file_id])
  10225.  REFERENCES
  10226.    [dbo].[file]     ([id])
  10227.     ON DELETE NO ACTION
  10228.     ON UPDATE NO ACTION
  10229.  
  10230. GO
  10231.  
  10232. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'gadget_config$gadget_config_gadget_id_gadget_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10233. ALTER TABLE [dbo].[gadget_config] DROP CONSTRAINT [gadget_config$gadget_config_gadget_id_gadget_id]
  10234.  GO
  10235.  
  10236.  
  10237.  
  10238. ALTER TABLE [dbo].[gadget_config]
  10239.  ADD CONSTRAINT [gadget_config$gadget_config_gadget_id_gadget_id]
  10240.  FOREIGN KEY
  10241.    ([gadget_id])
  10242.  REFERENCES
  10243.    [dbo].[gadget]     ([id])
  10244.     ON DELETE NO ACTION
  10245.     ON UPDATE NO ACTION
  10246.  
  10247. GO
  10248.  
  10249. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member$member_invite_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10250. ALTER TABLE [dbo].[member] DROP CONSTRAINT [member$member_invite_member_id_member_id]
  10251.  GO
  10252.  
  10253.  
  10254.  
  10255. ALTER TABLE [dbo].[member]
  10256.  ADD CONSTRAINT [member$member_invite_member_id_member_id]
  10257.  FOREIGN KEY
  10258.    ([invite_member_id])
  10259.  REFERENCES
  10260.    [dbo].[member]     ([id])
  10261.     ON DELETE NO ACTION
  10262.     ON UPDATE NO ACTION
  10263.  
  10264. GO
  10265.  
  10266. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_application$member_application_application_id_application_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10267. ALTER TABLE [dbo].[member_application] DROP CONSTRAINT [member_application$member_application_application_id_application_id]
  10268.  GO
  10269.  
  10270.  
  10271.  
  10272. ALTER TABLE [dbo].[member_application]
  10273.  ADD CONSTRAINT [member_application$member_application_application_id_application_id]
  10274.  FOREIGN KEY
  10275.    ([application_id])
  10276.  REFERENCES
  10277.    [dbo].[application]     ([id])
  10278.     ON DELETE NO ACTION
  10279.     ON UPDATE NO ACTION
  10280.  
  10281. GO
  10282.  
  10283. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_application$member_application_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10284. ALTER TABLE [dbo].[member_application] DROP CONSTRAINT [member_application$member_application_member_id_member_id]
  10285.  GO
  10286.  
  10287.  
  10288.  
  10289. ALTER TABLE [dbo].[member_application]
  10290.  ADD CONSTRAINT [member_application$member_application_member_id_member_id]
  10291.  FOREIGN KEY
  10292.    ([member_id])
  10293.  REFERENCES
  10294.    [dbo].[member]     ([id])
  10295.     ON DELETE NO ACTION
  10296.     ON UPDATE NO ACTION
  10297.  
  10298. GO
  10299.  
  10300. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_application_setting$mmmi'  AND sc.name=N'dbo'  AND type in (N'F'))
  10301. ALTER TABLE [dbo].[member_application_setting] DROP CONSTRAINT [member_application_setting$mmmi]
  10302.  GO
  10303.  
  10304.  
  10305.  
  10306. ALTER TABLE [dbo].[member_application_setting]
  10307.  ADD CONSTRAINT [member_application_setting$mmmi]
  10308.  FOREIGN KEY
  10309.    ([member_application_id])
  10310.  REFERENCES
  10311.    [dbo].[member_application]     ([id])
  10312.     ON DELETE NO ACTION
  10313.     ON UPDATE NO ACTION
  10314.  
  10315. GO
  10316.  
  10317. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_config$member_config_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10318. ALTER TABLE [dbo].[member_config] DROP CONSTRAINT [member_config$member_config_member_id_member_id]
  10319.  GO
  10320.  
  10321.  
  10322.  
  10323. ALTER TABLE [dbo].[member_config]
  10324.  ADD CONSTRAINT [member_config$member_config_member_id_member_id]
  10325.  FOREIGN KEY
  10326.    ([member_id])
  10327.  REFERENCES
  10328.    [dbo].[member]     ([id])
  10329.     ON DELETE NO ACTION
  10330.     ON UPDATE NO ACTION
  10331.  
  10332. GO
  10333.  
  10334. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_image$member_image_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10335. ALTER TABLE [dbo].[member_image] DROP CONSTRAINT [member_image$member_image_file_id_file_id]
  10336.  GO
  10337.  
  10338.  
  10339.  
  10340. ALTER TABLE [dbo].[member_image]
  10341.  ADD CONSTRAINT [member_image$member_image_file_id_file_id]
  10342.  FOREIGN KEY
  10343.    ([file_id])
  10344.  REFERENCES
  10345.    [dbo].[file]     ([id])
  10346.     ON DELETE NO ACTION
  10347.     ON UPDATE NO ACTION
  10348.  
  10349. GO
  10350.  
  10351. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_image$member_image_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10352. ALTER TABLE [dbo].[member_image] DROP CONSTRAINT [member_image$member_image_member_id_member_id]
  10353.  GO
  10354.  
  10355.  
  10356.  
  10357. ALTER TABLE [dbo].[member_image]
  10358.  ADD CONSTRAINT [member_image$member_image_member_id_member_id]
  10359.  FOREIGN KEY
  10360.    ([member_id])
  10361.  REFERENCES
  10362.    [dbo].[member]     ([id])
  10363.     ON DELETE NO ACTION
  10364.     ON UPDATE NO ACTION
  10365.  
  10366. GO
  10367.  
  10368. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_profile$member_profile_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10369. ALTER TABLE [dbo].[member_profile] DROP CONSTRAINT [member_profile$member_profile_member_id_member_id]
  10370.  GO
  10371.  
  10372.  
  10373.  
  10374. ALTER TABLE [dbo].[member_profile]
  10375.  ADD CONSTRAINT [member_profile$member_profile_member_id_member_id]
  10376.  FOREIGN KEY
  10377.    ([member_id])
  10378.  REFERENCES
  10379.    [dbo].[member]     ([id])
  10380.     ON DELETE NO ACTION
  10381.     ON UPDATE NO ACTION
  10382.  
  10383. GO
  10384.  
  10385. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_profile$member_profile_profile_id_profile_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10386. ALTER TABLE [dbo].[member_profile] DROP CONSTRAINT [member_profile$member_profile_profile_id_profile_id]
  10387.  GO
  10388.  
  10389.  
  10390.  
  10391. ALTER TABLE [dbo].[member_profile]
  10392.  ADD CONSTRAINT [member_profile$member_profile_profile_id_profile_id]
  10393.  FOREIGN KEY
  10394.    ([profile_id])
  10395.  REFERENCES
  10396.    [dbo].[profile]     ([id])
  10397.     ON DELETE NO ACTION
  10398.     ON UPDATE NO ACTION
  10399.  
  10400. GO
  10401.  
  10402. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_profile$member_profile_profile_option_id_profile_option_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10403. ALTER TABLE [dbo].[member_profile] DROP CONSTRAINT [member_profile$member_profile_profile_option_id_profile_option_id]
  10404.  GO
  10405.  
  10406.  
  10407.  
  10408. ALTER TABLE [dbo].[member_profile]
  10409.  ADD CONSTRAINT [member_profile$member_profile_profile_option_id_profile_option_id]
  10410.  FOREIGN KEY
  10411.    ([profile_option_id])
  10412.  REFERENCES
  10413.    [dbo].[profile_option]     ([id])
  10414.     ON DELETE NO ACTION
  10415.     ON UPDATE NO ACTION
  10416.  
  10417. GO
  10418.  
  10419. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_relationship$member_relationship_member_id_from_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10420. ALTER TABLE [dbo].[member_relationship] DROP CONSTRAINT [member_relationship$member_relationship_member_id_from_member_id]
  10421.  GO
  10422.  
  10423.  
  10424.  
  10425. ALTER TABLE [dbo].[member_relationship]
  10426.  ADD CONSTRAINT [member_relationship$member_relationship_member_id_from_member_id]
  10427.  FOREIGN KEY
  10428.    ([member_id_from])
  10429.  REFERENCES
  10430.    [dbo].[member]     ([id])
  10431.     ON DELETE NO ACTION
  10432.     ON UPDATE NO ACTION
  10433.  
  10434. GO
  10435.  
  10436. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'member_relationship$member_relationship_member_id_to_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10437. ALTER TABLE [dbo].[member_relationship] DROP CONSTRAINT [member_relationship$member_relationship_member_id_to_member_id]
  10438.  GO
  10439.  
  10440.  
  10441.  
  10442. ALTER TABLE [dbo].[member_relationship]
  10443.  ADD CONSTRAINT [member_relationship$member_relationship_member_id_to_member_id]
  10444.  FOREIGN KEY
  10445.    ([member_id_to])
  10446.  REFERENCES
  10447.    [dbo].[member]     ([id])
  10448.     ON DELETE NO ACTION
  10449.     ON UPDATE NO ACTION
  10450.  
  10451. GO
  10452.  
  10453. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message$message_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10454. ALTER TABLE [dbo].[message] DROP CONSTRAINT [message$message_member_id_member_id]
  10455.  GO
  10456.  
  10457.  
  10458.  
  10459. ALTER TABLE [dbo].[message]
  10460.  ADD CONSTRAINT [message$message_member_id_member_id]
  10461.  FOREIGN KEY
  10462.    ([member_id])
  10463.  REFERENCES
  10464.    [dbo].[member]     ([id])
  10465.     ON DELETE NO ACTION
  10466.     ON UPDATE NO ACTION
  10467.  
  10468. GO
  10469.  
  10470. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message$message_message_type_id_message_type_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10471. ALTER TABLE [dbo].[message] DROP CONSTRAINT [message$message_message_type_id_message_type_id]
  10472.  GO
  10473.  
  10474.  
  10475.  
  10476. ALTER TABLE [dbo].[message]
  10477.  ADD CONSTRAINT [message$message_message_type_id_message_type_id]
  10478.  FOREIGN KEY
  10479.    ([message_type_id])
  10480.  REFERENCES
  10481.    [dbo].[message_type]     ([id])
  10482.     ON DELETE NO ACTION
  10483.     ON UPDATE NO ACTION
  10484.  
  10485. GO
  10486.  
  10487. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_file$message_file_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10488. ALTER TABLE [dbo].[message_file] DROP CONSTRAINT [message_file$message_file_file_id_file_id]
  10489.  GO
  10490.  
  10491.  
  10492.  
  10493. ALTER TABLE [dbo].[message_file]
  10494.  ADD CONSTRAINT [message_file$message_file_file_id_file_id]
  10495.  FOREIGN KEY
  10496.    ([file_id])
  10497.  REFERENCES
  10498.    [dbo].[file]     ([id])
  10499.     ON DELETE NO ACTION
  10500.     ON UPDATE NO ACTION
  10501.  
  10502. GO
  10503.  
  10504. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_file$message_file_message_id_message_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10505. ALTER TABLE [dbo].[message_file] DROP CONSTRAINT [message_file$message_file_message_id_message_id]
  10506.  GO
  10507.  
  10508.  
  10509.  
  10510. ALTER TABLE [dbo].[message_file]
  10511.  ADD CONSTRAINT [message_file$message_file_message_id_message_id]
  10512.  FOREIGN KEY
  10513.    ([message_id])
  10514.  REFERENCES
  10515.    [dbo].[message]     ([id])
  10516.     ON DELETE NO ACTION
  10517.     ON UPDATE NO ACTION
  10518.  
  10519. GO
  10520.  
  10521. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_send_list$message_send_list_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10522. ALTER TABLE [dbo].[message_send_list] DROP CONSTRAINT [message_send_list$message_send_list_member_id_member_id]
  10523.  GO
  10524.  
  10525.  
  10526.  
  10527. ALTER TABLE [dbo].[message_send_list]
  10528.  ADD CONSTRAINT [message_send_list$message_send_list_member_id_member_id]
  10529.  FOREIGN KEY
  10530.    ([member_id])
  10531.  REFERENCES
  10532.    [dbo].[member]     ([id])
  10533.     ON DELETE NO ACTION
  10534.     ON UPDATE NO ACTION
  10535.  
  10536. GO
  10537.  
  10538. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_send_list$message_send_list_message_id_message_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10539. ALTER TABLE [dbo].[message_send_list] DROP CONSTRAINT [message_send_list$message_send_list_message_id_message_id]
  10540.  GO
  10541.  
  10542.  
  10543.  
  10544. ALTER TABLE [dbo].[message_send_list]
  10545.  ADD CONSTRAINT [message_send_list$message_send_list_message_id_message_id]
  10546.  FOREIGN KEY
  10547.    ([message_id])
  10548.  REFERENCES
  10549.    [dbo].[message]     ([id])
  10550.     ON DELETE NO ACTION
  10551.     ON UPDATE NO ACTION
  10552.  
  10553. GO
  10554.  
  10555. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'message_type_translation$message_type_translation_id_message_type_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10556. ALTER TABLE [dbo].[message_type_translation] DROP CONSTRAINT [message_type_translation$message_type_translation_id_message_type_id]
  10557.  GO
  10558.  
  10559.  
  10560.  
  10561. ALTER TABLE [dbo].[message_type_translation]
  10562.  ADD CONSTRAINT [message_type_translation$message_type_translation_id_message_type_id]
  10563.  FOREIGN KEY
  10564.    ([id])
  10565.  REFERENCES
  10566.    [dbo].[message_type]     ([id])
  10567.     ON DELETE NO ACTION
  10568.     ON UPDATE CASCADE
  10569.  
  10570. GO
  10571.  
  10572. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'navigation_translation$navigation_translation_id_navigation_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10573. ALTER TABLE [dbo].[navigation_translation] DROP CONSTRAINT [navigation_translation$navigation_translation_id_navigation_id]
  10574.  GO
  10575.  
  10576.  
  10577.  
  10578. ALTER TABLE [dbo].[navigation_translation]
  10579.  ADD CONSTRAINT [navigation_translation$navigation_translation_id_navigation_id]
  10580.  FOREIGN KEY
  10581.    ([id])
  10582.  REFERENCES
  10583.    [dbo].[navigation]     ([id])
  10584.     ON DELETE NO ACTION
  10585.     ON UPDATE CASCADE
  10586.  
  10587. GO
  10588.  
  10589. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'notification_mail_translation$notification_mail_translation_id_notification_mail_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10590. ALTER TABLE [dbo].[notification_mail_translation] DROP CONSTRAINT [notification_mail_translation$notification_mail_translation_id_notification_mail_id]
  10591.  GO
  10592.  
  10593.  
  10594.  
  10595. ALTER TABLE [dbo].[notification_mail_translation]
  10596.  ADD CONSTRAINT [notification_mail_translation$notification_mail_translation_id_notification_mail_id]
  10597.  FOREIGN KEY
  10598.    ([id])
  10599.  REFERENCES
  10600.    [dbo].[notification_mail]     ([id])
  10601.     ON DELETE NO ACTION
  10602.     ON UPDATE CASCADE
  10603.  
  10604. GO
  10605.  
  10606. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'o_auth_admin_token$o_auth_admin_token_oauth_consumer_id_oauth_consumer_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10607. ALTER TABLE [dbo].[o_auth_admin_token] DROP CONSTRAINT [o_auth_admin_token$o_auth_admin_token_oauth_consumer_id_oauth_consumer_id]
  10608.  GO
  10609.  
  10610.  
  10611.  
  10612. ALTER TABLE [dbo].[o_auth_admin_token]
  10613.  ADD CONSTRAINT [o_auth_admin_token$o_auth_admin_token_oauth_consumer_id_oauth_consumer_id]
  10614.  FOREIGN KEY
  10615.    ([oauth_consumer_id])
  10616.  REFERENCES
  10617.    [dbo].[oauth_consumer]     ([id])
  10618.     ON DELETE NO ACTION
  10619.     ON UPDATE NO ACTION
  10620.  
  10621. GO
  10622.  
  10623. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'o_auth_member_token$o_auth_member_token_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10624. ALTER TABLE [dbo].[o_auth_member_token] DROP CONSTRAINT [o_auth_member_token$o_auth_member_token_member_id_member_id]
  10625.  GO
  10626.  
  10627.  
  10628.  
  10629. ALTER TABLE [dbo].[o_auth_member_token]
  10630.  ADD CONSTRAINT [o_auth_member_token$o_auth_member_token_member_id_member_id]
  10631.  FOREIGN KEY
  10632.    ([member_id])
  10633.  REFERENCES
  10634.    [dbo].[member]     ([id])
  10635.     ON DELETE NO ACTION
  10636.     ON UPDATE NO ACTION
  10637.  
  10638. GO
  10639.  
  10640. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'o_auth_member_token$o_auth_member_token_oauth_consumer_id_oauth_consumer_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10641. ALTER TABLE [dbo].[o_auth_member_token] DROP CONSTRAINT [o_auth_member_token$o_auth_member_token_oauth_consumer_id_oauth_consumer_id]
  10642.  GO
  10643.  
  10644.  
  10645.  
  10646. ALTER TABLE [dbo].[o_auth_member_token]
  10647.  ADD CONSTRAINT [o_auth_member_token$o_auth_member_token_oauth_consumer_id_oauth_consumer_id]
  10648.  FOREIGN KEY
  10649.    ([oauth_consumer_id])
  10650.  REFERENCES
  10651.    [dbo].[oauth_consumer]     ([id])
  10652.     ON DELETE NO ACTION
  10653.     ON UPDATE NO ACTION
  10654.  
  10655. GO
  10656.  
  10657. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'oauth_consumer$oauth_consumer_file_id_file_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10658. ALTER TABLE [dbo].[oauth_consumer] DROP CONSTRAINT [oauth_consumer$oauth_consumer_file_id_file_id]
  10659.  GO
  10660.  
  10661.  
  10662.  
  10663. ALTER TABLE [dbo].[oauth_consumer]
  10664.  ADD CONSTRAINT [oauth_consumer$oauth_consumer_file_id_file_id]
  10665.  FOREIGN KEY
  10666.    ([file_id])
  10667.  REFERENCES
  10668.    [dbo].[file]     ([id])
  10669.     ON DELETE NO ACTION
  10670.     ON UPDATE NO ACTION
  10671.  
  10672. GO
  10673.  
  10674. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'oauth_consumer$oauth_consumer_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10675. ALTER TABLE [dbo].[oauth_consumer] DROP CONSTRAINT [oauth_consumer$oauth_consumer_member_id_member_id]
  10676.  GO
  10677.  
  10678.  
  10679.  
  10680. ALTER TABLE [dbo].[oauth_consumer]
  10681.  ADD CONSTRAINT [oauth_consumer$oauth_consumer_member_id_member_id]
  10682.  FOREIGN KEY
  10683.    ([member_id])
  10684.  REFERENCES
  10685.    [dbo].[member]     ([id])
  10686.     ON DELETE NO ACTION
  10687.     ON UPDATE NO ACTION
  10688.  
  10689. GO
  10690.  
  10691. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'openid_trust_log$openid_trust_log_member_id_member_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10692. ALTER TABLE [dbo].[openid_trust_log] DROP CONSTRAINT [openid_trust_log$openid_trust_log_member_id_member_id]
  10693.  GO
  10694.  
  10695.  
  10696.  
  10697. ALTER TABLE [dbo].[openid_trust_log]
  10698.  ADD CONSTRAINT [openid_trust_log$openid_trust_log_member_id_member_id]
  10699.  FOREIGN KEY
  10700.    ([member_id])
  10701.  REFERENCES
  10702.    [dbo].[member]     ([id])
  10703.     ON DELETE NO ACTION
  10704.     ON UPDATE NO ACTION
  10705.  
  10706. GO
  10707.  
  10708. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'profile_option$profile_option_profile_id_profile_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10709. ALTER TABLE [dbo].[profile_option] DROP CONSTRAINT [profile_option$profile_option_profile_id_profile_id]
  10710.  GO
  10711.  
  10712.  
  10713.  
  10714. ALTER TABLE [dbo].[profile_option]
  10715.  ADD CONSTRAINT [profile_option$profile_option_profile_id_profile_id]
  10716.  FOREIGN KEY
  10717.    ([profile_id])
  10718.  REFERENCES
  10719.    [dbo].[profile]     ([id])
  10720.     ON DELETE NO ACTION
  10721.     ON UPDATE NO ACTION
  10722.  
  10723. GO
  10724.  
  10725. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'profile_option_translation$profile_option_translation_id_profile_option_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10726. ALTER TABLE [dbo].[profile_option_translation] DROP CONSTRAINT [profile_option_translation$profile_option_translation_id_profile_option_id]
  10727.  GO
  10728.  
  10729.  
  10730.  
  10731. ALTER TABLE [dbo].[profile_option_translation]
  10732.  ADD CONSTRAINT [profile_option_translation$profile_option_translation_id_profile_option_id]
  10733.  FOREIGN KEY
  10734.    ([id])
  10735.  REFERENCES
  10736.    [dbo].[profile_option]     ([id])
  10737.     ON DELETE NO ACTION
  10738.     ON UPDATE CASCADE
  10739.  
  10740. GO
  10741.  
  10742. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'profile_translation$profile_translation_id_profile_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10743. ALTER TABLE [dbo].[profile_translation] DROP CONSTRAINT [profile_translation$profile_translation_id_profile_id]
  10744.  GO
  10745.  
  10746.  
  10747.  
  10748. ALTER TABLE [dbo].[profile_translation]
  10749.  ADD CONSTRAINT [profile_translation$profile_translation_id_profile_id]
  10750.  FOREIGN KEY
  10751.    ([id])
  10752.  REFERENCES
  10753.    [dbo].[profile]     ([id])
  10754.     ON DELETE NO ACTION
  10755.     ON UPDATE CASCADE
  10756.  
  10757. GO
  10758.  
  10759. IF EXISTS (SELECT * FROM sys.objects so JOIN sys.schemas sc ON so.schema_id = sc.schema_id WHERE so.name = N'sns_term_translation$sns_term_translation_id_sns_term_id'  AND sc.name=N'dbo'  AND type in (N'F'))
  10760. ALTER TABLE [dbo].[sns_term_translation] DROP CONSTRAINT [sns_term_translation$sns_term_translation_id_sns_term_id]
  10761.  GO
  10762.  
  10763.  
  10764.  
  10765. ALTER TABLE [dbo].[sns_term_translation]
  10766.  ADD CONSTRAINT [sns_term_translation$sns_term_translation_id_sns_term_id]
  10767.  FOREIGN KEY
  10768.    ([id])
  10769.  REFERENCES
  10770.    [dbo].[sns_term]     ([id])
  10771.     ON DELETE NO ACTION
  10772.     ON UPDATE CASCADE
  10773.  
  10774. GO
RAW Paste Data