· 8 years ago · Jan 14, 2018, 07:36 AM
1 IF NOT EXISTS(SELECT * FROM sys.schemas WHERE [name] = N'dbo')
2 EXEC (N'CREATE SCHEMA dbo')
3 GO
4IF 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'))
5BEGIN
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]
38END
39GO
40
41SET ANSI_NULLS ON
42GO
43SET QUOTED_IDENTIFIER ON
44GO
45CREATE 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)
173GO
174BEGIN 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'
179END TRY
180BEGIN CATCH
181 IF (@@TRANCOUNT > 0) ROLLBACK
182 PRINT ERROR_MESSAGE()
183END CATCH
184GO
185IF 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'))
186BEGIN
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]
219END
220GO
221
222SET ANSI_NULLS ON
223GO
224SET QUOTED_IDENTIFIER ON
225GO
226CREATE 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)
273GO
274BEGIN 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'
279END TRY
280BEGIN CATCH
281 IF (@@TRANCOUNT > 0) ROLLBACK
282 PRINT ERROR_MESSAGE()
283END CATCH
284GO
285IF 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'))
286BEGIN
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]
319END
320GO
321
322SET ANSI_NULLS ON
323GO
324SET QUOTED_IDENTIFIER ON
325GO
326CREATE 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(1,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)
359GO
360BEGIN 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'
365END TRY
366BEGIN CATCH
367 IF (@@TRANCOUNT > 0) ROLLBACK
368 PRINT ERROR_MESSAGE()
369END CATCH
370GO
371IF 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'))
372BEGIN
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]
405END
406GO
407
408SET ANSI_NULLS ON
409GO
410SET QUOTED_IDENTIFIER ON
411GO
412CREATE 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)
430GO
431BEGIN TRY
432 EXEC sp_addextendedproperty
433 N'MS_SSMA_SOURCE', N'dbo.album',
434 N'SCHEMA', N'dbo',
435 N'TABLE', N'album'
436END TRY
437BEGIN CATCH
438 IF (@@TRANCOUNT > 0) ROLLBACK
439 PRINT ERROR_MESSAGE()
440END CATCH
441GO
442IF 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'))
443BEGIN
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]
476END
477GO
478
479SET ANSI_NULLS ON
480GO
481SET QUOTED_IDENTIFIER ON
482GO
483CREATE 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)
495GO
496BEGIN 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'
501END TRY
502BEGIN CATCH
503 IF (@@TRANCOUNT > 0) ROLLBACK
504 PRINT ERROR_MESSAGE()
505END CATCH
506GO
507IF 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'))
508BEGIN
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]
541END
542GO
543
544SET ANSI_NULLS ON
545GO
546SET QUOTED_IDENTIFIER ON
547GO
548CREATE TABLE
549[dbo].[application]
550(
551 [id] bigint IDENTITY(1,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)
594GO
595BEGIN TRY
596 EXEC sp_addextendedproperty
597 N'MS_SSMA_SOURCE', N'dbo.application',
598 N'SCHEMA', N'dbo',
599 N'TABLE', N'application'
600END TRY
601BEGIN CATCH
602 IF (@@TRANCOUNT > 0) ROLLBACK
603 PRINT ERROR_MESSAGE()
604END CATCH
605GO
606IF 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'))
607BEGIN
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]
640END
641GO
642
643SET ANSI_NULLS ON
644GO
645SET QUOTED_IDENTIFIER ON
646GO
647CREATE 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)
657GO
658BEGIN 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'
663END TRY
664BEGIN CATCH
665 IF (@@TRANCOUNT > 0) ROLLBACK
666 PRINT ERROR_MESSAGE()
667END CATCH
668GO
669IF 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'))
670BEGIN
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]
703END
704GO
705
706SET ANSI_NULLS ON
707GO
708SET QUOTED_IDENTIFIER ON
709GO
710CREATE 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)
721GO
722BEGIN 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'
727END TRY
728BEGIN CATCH
729 IF (@@TRANCOUNT > 0) ROLLBACK
730 PRINT ERROR_MESSAGE()
731END CATCH
732GO
733IF 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'))
734BEGIN
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]
767END
768GO
769
770SET ANSI_NULLS ON
771GO
772SET QUOTED_IDENTIFIER ON
773GO
774CREATE 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)
783GO
784BEGIN 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'
789END TRY
790BEGIN CATCH
791 IF (@@TRANCOUNT > 0) ROLLBACK
792 PRINT ERROR_MESSAGE()
793END CATCH
794GO
795IF 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'))
796BEGIN
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]
829END
830GO
831
832SET ANSI_NULLS ON
833GO
834SET QUOTED_IDENTIFIER ON
835GO
836CREATE 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)
865GO
866BEGIN 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'
871END TRY
872BEGIN CATCH
873 IF (@@TRANCOUNT > 0) ROLLBACK
874 PRINT ERROR_MESSAGE()
875END CATCH
876GO
877IF 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'))
878BEGIN
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]
911END
912GO
913
914SET ANSI_NULLS ON
915GO
916SET QUOTED_IDENTIFIER ON
917GO
918CREATE 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)
928GO
929BEGIN TRY
930 EXEC sp_addextendedproperty
931 N'MS_SSMA_SOURCE', N'dbo.ashiato',
932 N'SCHEMA', N'dbo',
933 N'TABLE', N'ashiato'
934END TRY
935BEGIN CATCH
936 IF (@@TRANCOUNT > 0) ROLLBACK
937 PRINT ERROR_MESSAGE()
938END CATCH
939GO
940IF 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'))
941BEGIN
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]
974END
975GO
976
977SET ANSI_NULLS ON
978GO
979SET QUOTED_IDENTIFIER ON
980GO
981CREATE 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(1,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)
1020GO
1021BEGIN TRY
1022 EXEC sp_addextendedproperty
1023 N'MS_SSMA_SOURCE', N'dbo.banner',
1024 N'SCHEMA', N'dbo',
1025 N'TABLE', N'banner'
1026END TRY
1027BEGIN CATCH
1028 IF (@@TRANCOUNT > 0) ROLLBACK
1029 PRINT ERROR_MESSAGE()
1030END CATCH
1031GO
1032IF 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'))
1033BEGIN
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]
1066END
1067GO
1068
1069SET ANSI_NULLS ON
1070GO
1071SET QUOTED_IDENTIFIER ON
1072GO
1073CREATE 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)
1113GO
1114BEGIN 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'
1119END TRY
1120BEGIN CATCH
1121 IF (@@TRANCOUNT > 0) ROLLBACK
1122 PRINT ERROR_MESSAGE()
1123END CATCH
1124GO
1125IF 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'))
1126BEGIN
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]
1159END
1160GO
1161
1162SET ANSI_NULLS ON
1163GO
1164SET QUOTED_IDENTIFIER ON
1165GO
1166CREATE 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)
1195GO
1196BEGIN 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'
1201END TRY
1202BEGIN CATCH
1203 IF (@@TRANCOUNT > 0) ROLLBACK
1204 PRINT ERROR_MESSAGE()
1205END CATCH
1206GO
1207IF 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'))
1208BEGIN
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]
1241END
1242GO
1243
1244SET ANSI_NULLS ON
1245GO
1246SET QUOTED_IDENTIFIER ON
1247GO
1248CREATE 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)
1275GO
1276BEGIN 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'
1281END TRY
1282BEGIN CATCH
1283 IF (@@TRANCOUNT > 0) ROLLBACK
1284 PRINT ERROR_MESSAGE()
1285END CATCH
1286GO
1287IF 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'))
1288BEGIN
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]
1321END
1322GO
1323
1324SET ANSI_NULLS ON
1325GO
1326SET QUOTED_IDENTIFIER ON
1327GO
1328CREATE 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)
1361GO
1362BEGIN TRY
1363 EXEC sp_addextendedproperty
1364 N'MS_SSMA_SOURCE', N'dbo.blacklist',
1365 N'SCHEMA', N'dbo',
1366 N'TABLE', N'blacklist'
1367END TRY
1368BEGIN CATCH
1369 IF (@@TRANCOUNT > 0) ROLLBACK
1370 PRINT ERROR_MESSAGE()
1371END CATCH
1372GO
1373IF 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'))
1374BEGIN
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]
1407END
1408GO
1409
1410SET ANSI_NULLS ON
1411GO
1412SET QUOTED_IDENTIFIER ON
1413GO
1414CREATE 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)
1426GO
1427BEGIN 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'
1432END TRY
1433BEGIN CATCH
1434 IF (@@TRANCOUNT > 0) ROLLBACK
1435 PRINT ERROR_MESSAGE()
1436END CATCH
1437GO
1438IF 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'))
1439BEGIN
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]
1472END
1473GO
1474
1475SET ANSI_NULLS ON
1476GO
1477SET QUOTED_IDENTIFIER ON
1478GO
1479CREATE 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)
1516GO
1517BEGIN TRY
1518 EXEC sp_addextendedproperty
1519 N'MS_SSMA_SOURCE', N'dbo.community',
1520 N'SCHEMA', N'dbo',
1521 N'TABLE', N'community'
1522END TRY
1523BEGIN CATCH
1524 IF (@@TRANCOUNT > 0) ROLLBACK
1525 PRINT ERROR_MESSAGE()
1526END CATCH
1527GO
1528IF 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'))
1529BEGIN
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]
1562END
1563GO
1564
1565SET ANSI_NULLS ON
1566GO
1567SET QUOTED_IDENTIFIER ON
1568GO
1569CREATE 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(1,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)
1617GO
1618BEGIN 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'
1623END TRY
1624BEGIN CATCH
1625 IF (@@TRANCOUNT > 0) ROLLBACK
1626 PRINT ERROR_MESSAGE()
1627END CATCH
1628GO
1629IF 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'))
1630BEGIN
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]
1663END
1664GO
1665
1666SET ANSI_NULLS ON
1667GO
1668SET QUOTED_IDENTIFIER ON
1669GO
1670CREATE 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)
1710GO
1711BEGIN 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'
1716END TRY
1717BEGIN CATCH
1718 IF (@@TRANCOUNT > 0) ROLLBACK
1719 PRINT ERROR_MESSAGE()
1720END CATCH
1721GO
1722IF 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'))
1723BEGIN
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]
1756END
1757GO
1758
1759SET ANSI_NULLS ON
1760GO
1761SET QUOTED_IDENTIFIER ON
1762GO
1763CREATE 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)
1780GO
1781BEGIN 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'
1786END TRY
1787BEGIN CATCH
1788 IF (@@TRANCOUNT > 0) ROLLBACK
1789 PRINT ERROR_MESSAGE()
1790END CATCH
1791GO
1792IF 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'))
1793BEGIN
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]
1826END
1827GO
1828
1829SET ANSI_NULLS ON
1830GO
1831SET QUOTED_IDENTIFIER ON
1832GO
1833CREATE 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)
1850GO
1851BEGIN 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'
1856END TRY
1857BEGIN CATCH
1858 IF (@@TRANCOUNT > 0) ROLLBACK
1859 PRINT ERROR_MESSAGE()
1860END CATCH
1861GO
1862IF 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'))
1863BEGIN
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]
1896END
1897GO
1898
1899SET ANSI_NULLS ON
1900GO
1901SET QUOTED_IDENTIFIER ON
1902GO
1903CREATE 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)
1911GO
1912BEGIN 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'
1917END TRY
1918BEGIN CATCH
1919 IF (@@TRANCOUNT > 0) ROLLBACK
1920 PRINT ERROR_MESSAGE()
1921END CATCH
1922GO
1923IF 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'))
1924BEGIN
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]
1957END
1958GO
1959
1960SET ANSI_NULLS ON
1961GO
1962SET QUOTED_IDENTIFIER ON
1963GO
1964CREATE 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)
1972GO
1973BEGIN 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'
1978END TRY
1979BEGIN CATCH
1980 IF (@@TRANCOUNT > 0) ROLLBACK
1981 PRINT ERROR_MESSAGE()
1982END CATCH
1983GO
1984IF 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'))
1985BEGIN
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]
2018END
2019GO
2020
2021SET ANSI_NULLS ON
2022GO
2023SET QUOTED_IDENTIFIER ON
2024GO
2025CREATE 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)
2034GO
2035BEGIN 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'
2040END TRY
2041BEGIN CATCH
2042 IF (@@TRANCOUNT > 0) ROLLBACK
2043 PRINT ERROR_MESSAGE()
2044END CATCH
2045GO
2046IF 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'))
2047BEGIN
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]
2080END
2081GO
2082
2083SET ANSI_NULLS ON
2084GO
2085SET QUOTED_IDENTIFIER ON
2086GO
2087CREATE 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)
2138GO
2139BEGIN 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'
2144END TRY
2145BEGIN CATCH
2146 IF (@@TRANCOUNT > 0) ROLLBACK
2147 PRINT ERROR_MESSAGE()
2148END CATCH
2149GO
2150IF 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'))
2151BEGIN
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]
2184END
2185GO
2186
2187SET ANSI_NULLS ON
2188GO
2189SET QUOTED_IDENTIFIER ON
2190GO
2191CREATE 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)
2235GO
2236BEGIN 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'
2241END TRY
2242BEGIN CATCH
2243 IF (@@TRANCOUNT > 0) ROLLBACK
2244 PRINT ERROR_MESSAGE()
2245END CATCH
2246GO
2247IF 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'))
2248BEGIN
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]
2281END
2282GO
2283
2284SET ANSI_NULLS ON
2285GO
2286SET QUOTED_IDENTIFIER ON
2287GO
2288CREATE 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)
2300GO
2301BEGIN 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'
2306END TRY
2307BEGIN CATCH
2308 IF (@@TRANCOUNT > 0) ROLLBACK
2309 PRINT ERROR_MESSAGE()
2310END CATCH
2311GO
2312IF 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'))
2313BEGIN
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]
2346END
2347GO
2348
2349SET ANSI_NULLS ON
2350GO
2351SET QUOTED_IDENTIFIER ON
2352GO
2353CREATE 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)
2370GO
2371BEGIN 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'
2376END TRY
2377BEGIN CATCH
2378 IF (@@TRANCOUNT > 0) ROLLBACK
2379 PRINT ERROR_MESSAGE()
2380END CATCH
2381GO
2382IF 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'))
2383BEGIN
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]
2416END
2417GO
2418
2419SET ANSI_NULLS ON
2420GO
2421SET QUOTED_IDENTIFIER ON
2422GO
2423CREATE 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)
2431GO
2432BEGIN 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'
2437END TRY
2438BEGIN CATCH
2439 IF (@@TRANCOUNT > 0) ROLLBACK
2440 PRINT ERROR_MESSAGE()
2441END CATCH
2442GO
2443IF 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'))
2444BEGIN
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]
2477END
2478GO
2479
2480SET ANSI_NULLS ON
2481GO
2482SET QUOTED_IDENTIFIER ON
2483GO
2484CREATE 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)
2492GO
2493BEGIN 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'
2498END TRY
2499BEGIN CATCH
2500 IF (@@TRANCOUNT > 0) ROLLBACK
2501 PRINT ERROR_MESSAGE()
2502END CATCH
2503GO
2504IF 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'))
2505BEGIN
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]
2538END
2539GO
2540
2541SET ANSI_NULLS ON
2542GO
2543SET QUOTED_IDENTIFIER ON
2544GO
2545CREATE 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)
2562GO
2563BEGIN 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'
2568END TRY
2569BEGIN CATCH
2570 IF (@@TRANCOUNT > 0) ROLLBACK
2571 PRINT ERROR_MESSAGE()
2572END CATCH
2573GO
2574IF 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'))
2575BEGIN
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]
2608END
2609GO
2610
2611SET ANSI_NULLS ON
2612GO
2613SET QUOTED_IDENTIFIER ON
2614GO
2615CREATE 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)
2646GO
2647BEGIN TRY
2648 EXEC sp_addextendedproperty
2649 N'MS_SSMA_SOURCE', N'dbo.diary',
2650 N'SCHEMA', N'dbo',
2651 N'TABLE', N'diary'
2652END TRY
2653BEGIN CATCH
2654 IF (@@TRANCOUNT > 0) ROLLBACK
2655 PRINT ERROR_MESSAGE()
2656END CATCH
2657GO
2658IF 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'))
2659BEGIN
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]
2692END
2693GO
2694
2695SET ANSI_NULLS ON
2696GO
2697SET QUOTED_IDENTIFIER ON
2698GO
2699CREATE 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)
2717GO
2718BEGIN 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'
2723END TRY
2724BEGIN CATCH
2725 IF (@@TRANCOUNT > 0) ROLLBACK
2726 PRINT ERROR_MESSAGE()
2727END CATCH
2728GO
2729IF 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'))
2730BEGIN
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]
2763END
2764GO
2765
2766SET ANSI_NULLS ON
2767GO
2768SET QUOTED_IDENTIFIER ON
2769GO
2770CREATE 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)
2777GO
2778BEGIN 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'
2783END TRY
2784BEGIN CATCH
2785 IF (@@TRANCOUNT > 0) ROLLBACK
2786 PRINT ERROR_MESSAGE()
2787END CATCH
2788GO
2789IF 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'))
2790BEGIN
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]
2823END
2824GO
2825
2826SET ANSI_NULLS ON
2827GO
2828SET QUOTED_IDENTIFIER ON
2829GO
2830CREATE 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)
2842GO
2843BEGIN 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'
2848END TRY
2849BEGIN CATCH
2850 IF (@@TRANCOUNT > 0) ROLLBACK
2851 PRINT ERROR_MESSAGE()
2852END CATCH
2853GO
2854IF 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'))
2855BEGIN
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]
2888END
2889GO
2890
2891SET ANSI_NULLS ON
2892GO
2893SET QUOTED_IDENTIFIER ON
2894GO
2895CREATE 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)
2915GO
2916BEGIN 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'
2921END TRY
2922BEGIN CATCH
2923 IF (@@TRANCOUNT > 0) ROLLBACK
2924 PRINT ERROR_MESSAGE()
2925END CATCH
2926GO
2927IF 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'))
2928BEGIN
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]
2961END
2962GO
2963
2964SET ANSI_NULLS ON
2965GO
2966SET QUOTED_IDENTIFIER ON
2967GO
2968CREATE 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)
2976GO
2977BEGIN 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'
2982END TRY
2983BEGIN CATCH
2984 IF (@@TRANCOUNT > 0) ROLLBACK
2985 PRINT ERROR_MESSAGE()
2986END CATCH
2987GO
2988IF 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'))
2989BEGIN
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]
3022END
3023GO
3024
3025SET ANSI_NULLS ON
3026GO
3027SET QUOTED_IDENTIFIER ON
3028GO
3029CREATE 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)
3038GO
3039BEGIN TRY
3040 EXEC sp_addextendedproperty
3041 N'MS_SSMA_SOURCE', N'dbo.favorite',
3042 N'SCHEMA', N'dbo',
3043 N'TABLE', N'favorite'
3044END TRY
3045BEGIN CATCH
3046 IF (@@TRANCOUNT > 0) ROLLBACK
3047 PRINT ERROR_MESSAGE()
3048END CATCH
3049GO
3050IF 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'))
3051BEGIN
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]
3084END
3085GO
3086
3087SET ANSI_NULLS ON
3088GO
3089SET QUOTED_IDENTIFIER ON
3090GO
3091CREATE 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)
3142GO
3143BEGIN TRY
3144 EXEC sp_addextendedproperty
3145 N'MS_SSMA_SOURCE', N'dbo.file',
3146 N'SCHEMA', N'dbo',
3147 N'TABLE', N'file'
3148END TRY
3149BEGIN CATCH
3150 IF (@@TRANCOUNT > 0) ROLLBACK
3151 PRINT ERROR_MESSAGE()
3152END CATCH
3153GO
3154IF 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'))
3155BEGIN
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]
3188END
3189GO
3190
3191SET ANSI_NULLS ON
3192GO
3193SET QUOTED_IDENTIFIER ON
3194GO
3195CREATE 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)
3216GO
3217BEGIN 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'
3222END TRY
3223BEGIN CATCH
3224 IF (@@TRANCOUNT > 0) ROLLBACK
3225 PRINT ERROR_MESSAGE()
3226END CATCH
3227GO
3228IF 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'))
3229BEGIN
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]
3262END
3263GO
3264
3265SET ANSI_NULLS ON
3266GO
3267SET QUOTED_IDENTIFIER ON
3268GO
3269CREATE 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(1,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)
3309GO
3310BEGIN TRY
3311 EXEC sp_addextendedproperty
3312 N'MS_SSMA_SOURCE', N'dbo.gadget',
3313 N'SCHEMA', N'dbo',
3314 N'TABLE', N'gadget'
3315END TRY
3316BEGIN CATCH
3317 IF (@@TRANCOUNT > 0) ROLLBACK
3318 PRINT ERROR_MESSAGE()
3319END CATCH
3320GO
3321IF 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'))
3322BEGIN
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]
3355END
3356GO
3357
3358SET ANSI_NULLS ON
3359GO
3360SET QUOTED_IDENTIFIER ON
3361GO
3362CREATE 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)
3402GO
3403BEGIN 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'
3408END TRY
3409BEGIN CATCH
3410 IF (@@TRANCOUNT > 0) ROLLBACK
3411 PRINT ERROR_MESSAGE()
3412END CATCH
3413GO
3414IF 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'))
3415BEGIN
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]
3448END
3449GO
3450
3451SET ANSI_NULLS ON
3452GO
3453SET QUOTED_IDENTIFIER ON
3454GO
3455CREATE 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(1,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)
3500GO
3501BEGIN TRY
3502 EXEC sp_addextendedproperty
3503 N'MS_SSMA_SOURCE', N'dbo.member',
3504 N'SCHEMA', N'dbo',
3505 N'TABLE', N'member'
3506END TRY
3507BEGIN CATCH
3508 IF (@@TRANCOUNT > 0) ROLLBACK
3509 PRINT ERROR_MESSAGE()
3510END CATCH
3511GO
3512IF 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'))
3513BEGIN
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]
3546END
3547GO
3548
3549SET ANSI_NULLS ON
3550GO
3551SET QUOTED_IDENTIFIER ON
3552GO
3553CREATE 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)
3562GO
3563BEGIN 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'
3568END TRY
3569BEGIN CATCH
3570 IF (@@TRANCOUNT > 0) ROLLBACK
3571 PRINT ERROR_MESSAGE()
3572END CATCH
3573GO
3574IF 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'))
3575BEGIN
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]
3608END
3609GO
3610
3611SET ANSI_NULLS ON
3612GO
3613SET QUOTED_IDENTIFIER ON
3614GO
3615CREATE 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)
3625GO
3626BEGIN 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'
3631END TRY
3632BEGIN CATCH
3633 IF (@@TRANCOUNT > 0) ROLLBACK
3634 PRINT ERROR_MESSAGE()
3635END CATCH
3636GO
3637IF 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'))
3638BEGIN
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]
3671END
3672GO
3673
3674SET ANSI_NULLS ON
3675GO
3676SET QUOTED_IDENTIFIER ON
3677GO
3678CREATE 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(1,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)
3735GO
3736BEGIN 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'
3741END TRY
3742BEGIN CATCH
3743 IF (@@TRANCOUNT > 0) ROLLBACK
3744 PRINT ERROR_MESSAGE()
3745END CATCH
3746GO
3747IF 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'))
3748BEGIN
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]
3781END
3782GO
3783
3784SET ANSI_NULLS ON
3785GO
3786SET QUOTED_IDENTIFIER ON
3787GO
3788CREATE 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)
3822GO
3823BEGIN 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'
3828END TRY
3829BEGIN CATCH
3830 IF (@@TRANCOUNT > 0) ROLLBACK
3831 PRINT ERROR_MESSAGE()
3832END CATCH
3833GO
3834IF 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'))
3835BEGIN
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]
3868END
3869GO
3870
3871SET ANSI_NULLS ON
3872GO
3873SET QUOTED_IDENTIFIER ON
3874GO
3875CREATE 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(1,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)
3937GO
3938BEGIN 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'
3943END TRY
3944BEGIN CATCH
3945 IF (@@TRANCOUNT > 0) ROLLBACK
3946 PRINT ERROR_MESSAGE()
3947END CATCH
3948GO
3949IF 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'))
3950BEGIN
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]
3983END
3984GO
3985
3986SET ANSI_NULLS ON
3987GO
3988SET QUOTED_IDENTIFIER ON
3989GO
3990CREATE 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)
4038GO
4039BEGIN 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'
4044END TRY
4045BEGIN CATCH
4046 IF (@@TRANCOUNT > 0) ROLLBACK
4047 PRINT ERROR_MESSAGE()
4048END CATCH
4049GO
4050IF 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'))
4051BEGIN
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]
4084END
4085GO
4086
4087SET ANSI_NULLS ON
4088GO
4089SET QUOTED_IDENTIFIER ON
4090GO
4091CREATE 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)
4137GO
4138BEGIN TRY
4139 EXEC sp_addextendedproperty
4140 N'MS_SSMA_SOURCE', N'dbo.message',
4141 N'SCHEMA', N'dbo',
4142 N'TABLE', N'message'
4143END TRY
4144BEGIN CATCH
4145 IF (@@TRANCOUNT > 0) ROLLBACK
4146 PRINT ERROR_MESSAGE()
4147END CATCH
4148GO
4149IF 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'))
4150BEGIN
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]
4183END
4184GO
4185
4186SET ANSI_NULLS ON
4187GO
4188SET QUOTED_IDENTIFIER ON
4189GO
4190CREATE 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)
4199GO
4200BEGIN 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'
4205END TRY
4206BEGIN CATCH
4207 IF (@@TRANCOUNT > 0) ROLLBACK
4208 PRINT ERROR_MESSAGE()
4209END CATCH
4210GO
4211IF 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'))
4212BEGIN
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]
4245END
4246GO
4247
4248SET ANSI_NULLS ON
4249GO
4250SET QUOTED_IDENTIFIER ON
4251GO
4252CREATE 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)
4275GO
4276BEGIN 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'
4281END TRY
4282BEGIN CATCH
4283 IF (@@TRANCOUNT > 0) ROLLBACK
4284 PRINT ERROR_MESSAGE()
4285END CATCH
4286GO
4287IF 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'))
4288BEGIN
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]
4321END
4322GO
4323
4324SET ANSI_NULLS ON
4325GO
4326SET QUOTED_IDENTIFIER ON
4327GO
4328CREATE TABLE
4329[dbo].[message_type]
4330(
4331 [id] int IDENTITY(1,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)
4344GO
4345BEGIN 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'
4350END TRY
4351BEGIN CATCH
4352 IF (@@TRANCOUNT > 0) ROLLBACK
4353 PRINT ERROR_MESSAGE()
4354END CATCH
4355GO
4356IF 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'))
4357BEGIN
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]
4390END
4391GO
4392
4393SET ANSI_NULLS ON
4394GO
4395SET QUOTED_IDENTIFIER ON
4396GO
4397CREATE 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)
4413GO
4414BEGIN 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'
4419END TRY
4420BEGIN CATCH
4421 IF (@@TRANCOUNT > 0) ROLLBACK
4422 PRINT ERROR_MESSAGE()
4423END CATCH
4424GO
4425IF 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'))
4426BEGIN
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]
4459END
4460GO
4461
4462SET ANSI_NULLS ON
4463GO
4464SET QUOTED_IDENTIFIER ON
4465GO
4466CREATE 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(1,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)
4506GO
4507BEGIN TRY
4508 EXEC sp_addextendedproperty
4509 N'MS_SSMA_SOURCE', N'dbo.navigation',
4510 N'SCHEMA', N'dbo',
4511 N'TABLE', N'navigation'
4512END TRY
4513BEGIN CATCH
4514 IF (@@TRANCOUNT > 0) ROLLBACK
4515 PRINT ERROR_MESSAGE()
4516END CATCH
4517GO
4518IF 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'))
4519BEGIN
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]
4552END
4553GO
4554
4555SET ANSI_NULLS ON
4556GO
4557SET QUOTED_IDENTIFIER ON
4558GO
4559CREATE 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)
4588GO
4589BEGIN 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'
4594END TRY
4595BEGIN CATCH
4596 IF (@@TRANCOUNT > 0) ROLLBACK
4597 PRINT ERROR_MESSAGE()
4598END CATCH
4599GO
4600IF 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'))
4601BEGIN
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]
4634END
4635GO
4636
4637SET ANSI_NULLS ON
4638GO
4639SET QUOTED_IDENTIFIER ON
4640GO
4641CREATE 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)
4680GO
4681BEGIN 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'
4686END TRY
4687BEGIN CATCH
4688 IF (@@TRANCOUNT > 0) ROLLBACK
4689 PRINT ERROR_MESSAGE()
4690END CATCH
4691GO
4692IF 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'))
4693BEGIN
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]
4726END
4727GO
4728
4729SET ANSI_NULLS ON
4730GO
4731SET QUOTED_IDENTIFIER ON
4732GO
4733CREATE 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)
4772GO
4773BEGIN 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'
4778END TRY
4779BEGIN CATCH
4780 IF (@@TRANCOUNT > 0) ROLLBACK
4781 PRINT ERROR_MESSAGE()
4782END CATCH
4783GO
4784IF 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'))
4785BEGIN
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]
4818END
4819GO
4820
4821SET ANSI_NULLS ON
4822GO
4823SET QUOTED_IDENTIFIER ON
4824GO
4825CREATE 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)
4903GO
4904BEGIN 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'
4909END TRY
4910BEGIN CATCH
4911 IF (@@TRANCOUNT > 0) ROLLBACK
4912 PRINT ERROR_MESSAGE()
4913END CATCH
4914GO
4915IF 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'))
4916BEGIN
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]
4949END
4950GO
4951
4952SET ANSI_NULLS ON
4953GO
4954SET QUOTED_IDENTIFIER ON
4955GO
4956CREATE 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)
5041GO
5042BEGIN 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'
5047END TRY
5048BEGIN CATCH
5049 IF (@@TRANCOUNT > 0) ROLLBACK
5050 PRINT ERROR_MESSAGE()
5051END CATCH
5052GO
5053IF 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'))
5054BEGIN
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]
5087END
5088GO
5089
5090SET ANSI_NULLS ON
5091GO
5092SET QUOTED_IDENTIFIER ON
5093GO
5094CREATE 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)
5171GO
5172BEGIN 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'
5177END TRY
5178BEGIN CATCH
5179 IF (@@TRANCOUNT > 0) ROLLBACK
5180 PRINT ERROR_MESSAGE()
5181END CATCH
5182GO
5183IF 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'))
5184BEGIN
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]
5217END
5218GO
5219
5220SET ANSI_NULLS ON
5221GO
5222SET QUOTED_IDENTIFIER ON
5223GO
5224CREATE 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)
5271GO
5272BEGIN 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'
5277END TRY
5278BEGIN CATCH
5279 IF (@@TRANCOUNT > 0) ROLLBACK
5280 PRINT ERROR_MESSAGE()
5281END CATCH
5282GO
5283IF 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'))
5284BEGIN
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]
5317END
5318GO
5319
5320SET ANSI_NULLS ON
5321GO
5322SET QUOTED_IDENTIFIER ON
5323GO
5324CREATE 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)
5355GO
5356BEGIN TRY
5357 EXEC sp_addextendedproperty
5358 N'MS_SSMA_SOURCE', N'dbo.plugin',
5359 N'SCHEMA', N'dbo',
5360 N'TABLE', N'plugin'
5361END TRY
5362BEGIN CATCH
5363 IF (@@TRANCOUNT > 0) ROLLBACK
5364 PRINT ERROR_MESSAGE()
5365END CATCH
5366GO
5367IF 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'))
5368BEGIN
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]
5401END
5402GO
5403
5404SET ANSI_NULLS ON
5405GO
5406SET QUOTED_IDENTIFIER ON
5407GO
5408CREATE 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(1,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)
5552GO
5553BEGIN TRY
5554 EXEC sp_addextendedproperty
5555 N'MS_SSMA_SOURCE', N'dbo.profile',
5556 N'SCHEMA', N'dbo',
5557 N'TABLE', N'profile'
5558END TRY
5559BEGIN CATCH
5560 IF (@@TRANCOUNT > 0) ROLLBACK
5561 PRINT ERROR_MESSAGE()
5562END CATCH
5563GO
5564IF 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'))
5565BEGIN
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]
5598END
5599GO
5600
5601SET ANSI_NULLS ON
5602GO
5603SET QUOTED_IDENTIFIER ON
5604GO
5605CREATE 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)
5632GO
5633BEGIN 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'
5638END TRY
5639BEGIN CATCH
5640 IF (@@TRANCOUNT > 0) ROLLBACK
5641 PRINT ERROR_MESSAGE()
5642END CATCH
5643GO
5644IF 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'))
5645BEGIN
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]
5678END
5679GO
5680
5681SET ANSI_NULLS ON
5682GO
5683SET QUOTED_IDENTIFIER ON
5684GO
5685CREATE 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)
5714GO
5715BEGIN 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'
5720END TRY
5721BEGIN CATCH
5722 IF (@@TRANCOUNT > 0) ROLLBACK
5723 PRINT ERROR_MESSAGE()
5724END CATCH
5725GO
5726IF 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'))
5727BEGIN
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]
5760END
5761GO
5762
5763SET ANSI_NULLS ON
5764GO
5765SET QUOTED_IDENTIFIER ON
5766GO
5767CREATE 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)
5806GO
5807BEGIN 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'
5812END TRY
5813BEGIN CATCH
5814 IF (@@TRANCOUNT > 0) ROLLBACK
5815 PRINT ERROR_MESSAGE()
5816END CATCH
5817GO
5818IF 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'))
5819BEGIN
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]
5852END
5853GO
5854
5855SET ANSI_NULLS ON
5856GO
5857SET QUOTED_IDENTIFIER ON
5858GO
5859CREATE 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)
5890GO
5891BEGIN TRY
5892 EXEC sp_addextendedproperty
5893 N'MS_SSMA_SOURCE', N'dbo.session',
5894 N'SCHEMA', N'dbo',
5895 N'TABLE', N'session'
5896END TRY
5897BEGIN CATCH
5898 IF (@@TRANCOUNT > 0) ROLLBACK
5899 PRINT ERROR_MESSAGE()
5900END CATCH
5901GO
5902IF 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'))
5903BEGIN
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]
5936END
5937GO
5938
5939SET ANSI_NULLS ON
5940GO
5941SET QUOTED_IDENTIFIER ON
5942GO
5943CREATE 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)
5986GO
5987BEGIN 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'
5992END TRY
5993BEGIN CATCH
5994 IF (@@TRANCOUNT > 0) ROLLBACK
5995 PRINT ERROR_MESSAGE()
5996END CATCH
5997GO
5998IF 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'))
5999BEGIN
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]
6032END
6033GO
6034
6035SET ANSI_NULLS ON
6036GO
6037SET QUOTED_IDENTIFIER ON
6038GO
6039CREATE 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(1,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)
6070GO
6071BEGIN 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'
6076END TRY
6077BEGIN CATCH
6078 IF (@@TRANCOUNT > 0) ROLLBACK
6079 PRINT ERROR_MESSAGE()
6080END CATCH
6081GO
6082IF 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'))
6083BEGIN
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]
6116END
6117GO
6118
6119SET ANSI_NULLS ON
6120GO
6121SET QUOTED_IDENTIFIER ON
6122GO
6123CREATE 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(1,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)
6154GO
6155BEGIN 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'
6160END TRY
6161BEGIN CATCH
6162 IF (@@TRANCOUNT > 0) ROLLBACK
6163 PRINT ERROR_MESSAGE()
6164END CATCH
6165GO
6166IF 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'))
6167BEGIN
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]
6200END
6201GO
6202
6203SET ANSI_NULLS ON
6204GO
6205SET QUOTED_IDENTIFIER ON
6206GO
6207CREATE 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)
6236GO
6237BEGIN 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'
6242END TRY
6243BEGIN CATCH
6244 IF (@@TRANCOUNT > 0) ROLLBACK
6245 PRINT ERROR_MESSAGE()
6246END CATCH
6247GO
6248IF 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'))
6249ALTER TABLE [dbo].[activity_data] DROP CONSTRAINT [PK_activity_data_id]
6250 GO
6251
6252
6253
6254ALTER TABLE [dbo].[activity_data]
6255 ADD CONSTRAINT [PK_activity_data_id]
6256 PRIMARY KEY
6257 CLUSTERED ([id] ASC)
6258
6259GO
6260
6261IF 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'))
6262ALTER TABLE [dbo].[activity_image] DROP CONSTRAINT [PK_activity_image_id]
6263 GO
6264
6265
6266
6267ALTER TABLE [dbo].[activity_image]
6268 ADD CONSTRAINT [PK_activity_image_id]
6269 PRIMARY KEY
6270 CLUSTERED ([id] ASC)
6271
6272GO
6273
6274IF 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'))
6275ALTER TABLE [dbo].[admin_user] DROP CONSTRAINT [PK_admin_user_id]
6276 GO
6277
6278
6279
6280ALTER TABLE [dbo].[admin_user]
6281 ADD CONSTRAINT [PK_admin_user_id]
6282 PRIMARY KEY
6283 CLUSTERED ([id] ASC)
6284
6285GO
6286
6287IF 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'))
6288ALTER TABLE [dbo].[album] DROP CONSTRAINT [PK_album_id]
6289 GO
6290
6291
6292
6293ALTER TABLE [dbo].[album]
6294 ADD CONSTRAINT [PK_album_id]
6295 PRIMARY KEY
6296 CLUSTERED ([id] ASC)
6297
6298GO
6299
6300IF 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'))
6301ALTER TABLE [dbo].[album_image] DROP CONSTRAINT [PK_album_image_id]
6302 GO
6303
6304
6305
6306ALTER TABLE [dbo].[album_image]
6307 ADD CONSTRAINT [PK_album_image_id]
6308 PRIMARY KEY
6309 CLUSTERED ([id] ASC)
6310
6311GO
6312
6313IF 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'))
6314ALTER TABLE [dbo].[application] DROP CONSTRAINT [PK_application_id]
6315 GO
6316
6317
6318
6319ALTER TABLE [dbo].[application]
6320 ADD CONSTRAINT [PK_application_id]
6321 PRIMARY KEY
6322 CLUSTERED ([id] ASC)
6323
6324GO
6325
6326IF 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'))
6327ALTER TABLE [dbo].[application_invite] DROP CONSTRAINT [PK_application_invite_id]
6328 GO
6329
6330
6331
6332ALTER TABLE [dbo].[application_invite]
6333 ADD CONSTRAINT [PK_application_invite_id]
6334 PRIMARY KEY
6335 CLUSTERED ([id] ASC)
6336
6337GO
6338
6339IF 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'))
6340ALTER TABLE [dbo].[application_lifecycle_event_queue] DROP CONSTRAINT [PK_application_lifecycle_event_queue_id]
6341 GO
6342
6343
6344
6345ALTER TABLE [dbo].[application_lifecycle_event_queue]
6346 ADD CONSTRAINT [PK_application_lifecycle_event_queue_id]
6347 PRIMARY KEY
6348 CLUSTERED ([id] ASC)
6349
6350GO
6351
6352IF 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'))
6353ALTER TABLE [dbo].[application_persistent_data] DROP CONSTRAINT [PK_application_persistent_data_id]
6354 GO
6355
6356
6357
6358ALTER TABLE [dbo].[application_persistent_data]
6359 ADD CONSTRAINT [PK_application_persistent_data_id]
6360 PRIMARY KEY
6361 CLUSTERED ([id] ASC)
6362
6363GO
6364
6365IF 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'))
6366ALTER TABLE [dbo].[application_translation] DROP CONSTRAINT [PK_application_translation_id]
6367 GO
6368
6369
6370
6371ALTER TABLE [dbo].[application_translation]
6372 ADD CONSTRAINT [PK_application_translation_id]
6373 PRIMARY KEY
6374 CLUSTERED ([id] ASC, [lang] ASC)
6375
6376GO
6377
6378IF 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'))
6379ALTER TABLE [dbo].[ashiato] DROP CONSTRAINT [PK_ashiato_id]
6380 GO
6381
6382
6383
6384ALTER TABLE [dbo].[ashiato]
6385 ADD CONSTRAINT [PK_ashiato_id]
6386 PRIMARY KEY
6387 CLUSTERED ([id] ASC)
6388
6389GO
6390
6391IF 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'))
6392ALTER TABLE [dbo].[banner] DROP CONSTRAINT [PK_banner_id]
6393 GO
6394
6395
6396
6397ALTER TABLE [dbo].[banner]
6398 ADD CONSTRAINT [PK_banner_id]
6399 PRIMARY KEY
6400 CLUSTERED ([id] ASC)
6401
6402GO
6403
6404IF 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'))
6405ALTER TABLE [dbo].[banner_image] DROP CONSTRAINT [PK_banner_image_id]
6406 GO
6407
6408
6409
6410ALTER TABLE [dbo].[banner_image]
6411 ADD CONSTRAINT [PK_banner_image_id]
6412 PRIMARY KEY
6413 CLUSTERED ([id] ASC)
6414
6415GO
6416
6417IF 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'))
6418ALTER TABLE [dbo].[banner_translation] DROP CONSTRAINT [PK_banner_translation_id]
6419 GO
6420
6421
6422
6423ALTER TABLE [dbo].[banner_translation]
6424 ADD CONSTRAINT [PK_banner_translation_id]
6425 PRIMARY KEY
6426 CLUSTERED ([id] ASC, [lang] ASC)
6427
6428GO
6429
6430IF 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'))
6431ALTER TABLE [dbo].[banner_use_image] DROP CONSTRAINT [PK_banner_use_image_id]
6432 GO
6433
6434
6435
6436ALTER TABLE [dbo].[banner_use_image]
6437 ADD CONSTRAINT [PK_banner_use_image_id]
6438 PRIMARY KEY
6439 CLUSTERED ([id] ASC)
6440
6441GO
6442
6443IF 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'))
6444ALTER TABLE [dbo].[blacklist] DROP CONSTRAINT [PK_blacklist_id]
6445 GO
6446
6447
6448
6449ALTER TABLE [dbo].[blacklist]
6450 ADD CONSTRAINT [PK_blacklist_id]
6451 PRIMARY KEY
6452 CLUSTERED ([id] ASC)
6453
6454GO
6455
6456IF 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'))
6457ALTER TABLE [dbo].[blog_rss_cache] DROP CONSTRAINT [PK_blog_rss_cache_id]
6458 GO
6459
6460
6461
6462ALTER TABLE [dbo].[blog_rss_cache]
6463 ADD CONSTRAINT [PK_blog_rss_cache_id]
6464 PRIMARY KEY
6465 CLUSTERED ([id] ASC)
6466
6467GO
6468
6469IF 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'))
6470ALTER TABLE [dbo].[community] DROP CONSTRAINT [PK_community_id]
6471 GO
6472
6473
6474
6475ALTER TABLE [dbo].[community]
6476 ADD CONSTRAINT [PK_community_id]
6477 PRIMARY KEY
6478 CLUSTERED ([id] ASC)
6479
6480GO
6481
6482IF 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'))
6483ALTER TABLE [dbo].[community_category] DROP CONSTRAINT [PK_community_category_id]
6484 GO
6485
6486
6487
6488ALTER TABLE [dbo].[community_category]
6489 ADD CONSTRAINT [PK_community_category_id]
6490 PRIMARY KEY
6491 CLUSTERED ([id] ASC)
6492
6493GO
6494
6495IF 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'))
6496ALTER TABLE [dbo].[community_config] DROP CONSTRAINT [PK_community_config_id]
6497 GO
6498
6499
6500
6501ALTER TABLE [dbo].[community_config]
6502 ADD CONSTRAINT [PK_community_config_id]
6503 PRIMARY KEY
6504 CLUSTERED ([id] ASC)
6505
6506GO
6507
6508IF 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'))
6509ALTER TABLE [dbo].[community_event] DROP CONSTRAINT [PK_community_event_id]
6510 GO
6511
6512
6513
6514ALTER TABLE [dbo].[community_event]
6515 ADD CONSTRAINT [PK_community_event_id]
6516 PRIMARY KEY
6517 CLUSTERED ([id] ASC)
6518
6519GO
6520
6521IF 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'))
6522ALTER TABLE [dbo].[community_event_comment] DROP CONSTRAINT [PK_community_event_comment_id]
6523 GO
6524
6525
6526
6527ALTER TABLE [dbo].[community_event_comment]
6528 ADD CONSTRAINT [PK_community_event_comment_id]
6529 PRIMARY KEY
6530 CLUSTERED ([id] ASC)
6531
6532GO
6533
6534IF 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'))
6535ALTER TABLE [dbo].[community_event_comment_image] DROP CONSTRAINT [PK_community_event_comment_image_id]
6536 GO
6537
6538
6539
6540ALTER TABLE [dbo].[community_event_comment_image]
6541 ADD CONSTRAINT [PK_community_event_comment_image_id]
6542 PRIMARY KEY
6543 CLUSTERED ([id] ASC)
6544
6545GO
6546
6547IF 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'))
6548ALTER TABLE [dbo].[community_event_image] DROP CONSTRAINT [PK_community_event_image_id]
6549 GO
6550
6551
6552
6553ALTER TABLE [dbo].[community_event_image]
6554 ADD CONSTRAINT [PK_community_event_image_id]
6555 PRIMARY KEY
6556 CLUSTERED ([id] ASC)
6557
6558GO
6559
6560IF 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'))
6561ALTER TABLE [dbo].[community_event_member] DROP CONSTRAINT [PK_community_event_member_id]
6562 GO
6563
6564
6565
6566ALTER TABLE [dbo].[community_event_member]
6567 ADD CONSTRAINT [PK_community_event_member_id]
6568 PRIMARY KEY
6569 CLUSTERED ([id] ASC)
6570
6571GO
6572
6573IF 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'))
6574ALTER TABLE [dbo].[community_member] DROP CONSTRAINT [PK_community_member_id]
6575 GO
6576
6577
6578
6579ALTER TABLE [dbo].[community_member]
6580 ADD CONSTRAINT [PK_community_member_id]
6581 PRIMARY KEY
6582 CLUSTERED ([id] ASC)
6583
6584GO
6585
6586IF 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'))
6587ALTER TABLE [dbo].[community_member_position] DROP CONSTRAINT [PK_community_member_position_id]
6588 GO
6589
6590
6591
6592ALTER TABLE [dbo].[community_member_position]
6593 ADD CONSTRAINT [PK_community_member_position_id]
6594 PRIMARY KEY
6595 CLUSTERED ([id] ASC)
6596
6597GO
6598
6599IF 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'))
6600ALTER TABLE [dbo].[community_topic] DROP CONSTRAINT [PK_community_topic_id]
6601 GO
6602
6603
6604
6605ALTER TABLE [dbo].[community_topic]
6606 ADD CONSTRAINT [PK_community_topic_id]
6607 PRIMARY KEY
6608 CLUSTERED ([id] ASC)
6609
6610GO
6611
6612IF 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'))
6613ALTER TABLE [dbo].[community_topic_comment] DROP CONSTRAINT [PK_community_topic_comment_id]
6614 GO
6615
6616
6617
6618ALTER TABLE [dbo].[community_topic_comment]
6619 ADD CONSTRAINT [PK_community_topic_comment_id]
6620 PRIMARY KEY
6621 CLUSTERED ([id] ASC)
6622
6623GO
6624
6625IF 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'))
6626ALTER TABLE [dbo].[community_topic_comment_image] DROP CONSTRAINT [PK_community_topic_comment_image_id]
6627 GO
6628
6629
6630
6631ALTER TABLE [dbo].[community_topic_comment_image]
6632 ADD CONSTRAINT [PK_community_topic_comment_image_id]
6633 PRIMARY KEY
6634 CLUSTERED ([id] ASC)
6635
6636GO
6637
6638IF 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'))
6639ALTER TABLE [dbo].[community_topic_image] DROP CONSTRAINT [PK_community_topic_image_id]
6640 GO
6641
6642
6643
6644ALTER TABLE [dbo].[community_topic_image]
6645 ADD CONSTRAINT [PK_community_topic_image_id]
6646 PRIMARY KEY
6647 CLUSTERED ([id] ASC)
6648
6649GO
6650
6651IF 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'))
6652ALTER TABLE [dbo].[deleted_message] DROP CONSTRAINT [PK_deleted_message_id]
6653 GO
6654
6655
6656
6657ALTER TABLE [dbo].[deleted_message]
6658 ADD CONSTRAINT [PK_deleted_message_id]
6659 PRIMARY KEY
6660 CLUSTERED ([id] ASC)
6661
6662GO
6663
6664IF 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'))
6665ALTER TABLE [dbo].[diary] DROP CONSTRAINT [PK_diary_id]
6666 GO
6667
6668
6669
6670ALTER TABLE [dbo].[diary]
6671 ADD CONSTRAINT [PK_diary_id]
6672 PRIMARY KEY
6673 CLUSTERED ([id] ASC)
6674
6675GO
6676
6677IF 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'))
6678ALTER TABLE [dbo].[diary_comment] DROP CONSTRAINT [PK_diary_comment_id]
6679 GO
6680
6681
6682
6683ALTER TABLE [dbo].[diary_comment]
6684 ADD CONSTRAINT [PK_diary_comment_id]
6685 PRIMARY KEY
6686 CLUSTERED ([id] ASC)
6687
6688GO
6689
6690IF 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'))
6691ALTER TABLE [dbo].[diary_comment_image] DROP CONSTRAINT [PK_diary_comment_image_id]
6692 GO
6693
6694
6695
6696ALTER TABLE [dbo].[diary_comment_image]
6697 ADD CONSTRAINT [PK_diary_comment_image_id]
6698 PRIMARY KEY
6699 CLUSTERED ([id] ASC)
6700
6701GO
6702
6703IF 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'))
6704ALTER TABLE [dbo].[diary_comment_unread] DROP CONSTRAINT [PK_diary_comment_unread_diary_id]
6705 GO
6706
6707
6708
6709ALTER TABLE [dbo].[diary_comment_unread]
6710 ADD CONSTRAINT [PK_diary_comment_unread_diary_id]
6711 PRIMARY KEY
6712 CLUSTERED ([diary_id] ASC)
6713
6714GO
6715
6716IF 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'))
6717ALTER TABLE [dbo].[diary_comment_update] DROP CONSTRAINT [PK_diary_comment_update_diary_id]
6718 GO
6719
6720
6721
6722ALTER 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
6727GO
6728
6729IF 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'))
6730ALTER TABLE [dbo].[diary_image] DROP CONSTRAINT [PK_diary_image_id]
6731 GO
6732
6733
6734
6735ALTER TABLE [dbo].[diary_image]
6736 ADD CONSTRAINT [PK_diary_image_id]
6737 PRIMARY KEY
6738 CLUSTERED ([id] ASC)
6739
6740GO
6741
6742IF 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'))
6743ALTER TABLE [dbo].[favorite] DROP CONSTRAINT [PK_favorite_id]
6744 GO
6745
6746
6747
6748ALTER TABLE [dbo].[favorite]
6749 ADD CONSTRAINT [PK_favorite_id]
6750 PRIMARY KEY
6751 CLUSTERED ([id] ASC)
6752
6753GO
6754
6755IF 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'))
6756ALTER TABLE [dbo].[file] DROP CONSTRAINT [PK_file_id]
6757 GO
6758
6759
6760
6761ALTER TABLE [dbo].[file]
6762 ADD CONSTRAINT [PK_file_id]
6763 PRIMARY KEY
6764 CLUSTERED ([id] ASC)
6765
6766GO
6767
6768IF 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'))
6769ALTER TABLE [dbo].[file_bin] DROP CONSTRAINT [PK_file_bin_file_id]
6770 GO
6771
6772
6773
6774ALTER TABLE [dbo].[file_bin]
6775 ADD CONSTRAINT [PK_file_bin_file_id]
6776 PRIMARY KEY
6777 CLUSTERED ([file_id] ASC)
6778
6779GO
6780
6781IF 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'))
6782ALTER TABLE [dbo].[gadget] DROP CONSTRAINT [PK_gadget_id]
6783 GO
6784
6785
6786
6787ALTER TABLE [dbo].[gadget]
6788 ADD CONSTRAINT [PK_gadget_id]
6789 PRIMARY KEY
6790 CLUSTERED ([id] ASC)
6791
6792GO
6793
6794IF 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'))
6795ALTER TABLE [dbo].[gadget_config] DROP CONSTRAINT [PK_gadget_config_id]
6796 GO
6797
6798
6799
6800ALTER TABLE [dbo].[gadget_config]
6801 ADD CONSTRAINT [PK_gadget_config_id]
6802 PRIMARY KEY
6803 CLUSTERED ([id] ASC)
6804
6805GO
6806
6807IF 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'))
6808ALTER TABLE [dbo].[member] DROP CONSTRAINT [PK_member_id]
6809 GO
6810
6811
6812
6813ALTER TABLE [dbo].[member]
6814 ADD CONSTRAINT [PK_member_id]
6815 PRIMARY KEY
6816 CLUSTERED ([id] ASC)
6817
6818GO
6819
6820IF 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'))
6821ALTER TABLE [dbo].[member_application] DROP CONSTRAINT [PK_member_application_id]
6822 GO
6823
6824
6825
6826ALTER TABLE [dbo].[member_application]
6827 ADD CONSTRAINT [PK_member_application_id]
6828 PRIMARY KEY
6829 CLUSTERED ([id] ASC)
6830
6831GO
6832
6833IF 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'))
6834ALTER TABLE [dbo].[member_application_setting] DROP CONSTRAINT [PK_member_application_setting_id]
6835 GO
6836
6837
6838
6839ALTER TABLE [dbo].[member_application_setting]
6840 ADD CONSTRAINT [PK_member_application_setting_id]
6841 PRIMARY KEY
6842 CLUSTERED ([id] ASC)
6843
6844GO
6845
6846IF 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'))
6847ALTER TABLE [dbo].[member_config] DROP CONSTRAINT [PK_member_config_id]
6848 GO
6849
6850
6851
6852ALTER TABLE [dbo].[member_config]
6853 ADD CONSTRAINT [PK_member_config_id]
6854 PRIMARY KEY
6855 CLUSTERED ([id] ASC)
6856
6857GO
6858
6859IF 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'))
6860ALTER TABLE [dbo].[member_image] DROP CONSTRAINT [PK_member_image_id]
6861 GO
6862
6863
6864
6865ALTER TABLE [dbo].[member_image]
6866 ADD CONSTRAINT [PK_member_image_id]
6867 PRIMARY KEY
6868 CLUSTERED ([id] ASC)
6869
6870GO
6871
6872IF 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'))
6873ALTER TABLE [dbo].[member_profile] DROP CONSTRAINT [PK_member_profile_id]
6874 GO
6875
6876
6877
6878ALTER TABLE [dbo].[member_profile]
6879 ADD CONSTRAINT [PK_member_profile_id]
6880 PRIMARY KEY
6881 CLUSTERED ([id] ASC)
6882
6883GO
6884
6885IF 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'))
6886ALTER TABLE [dbo].[member_relationship] DROP CONSTRAINT [PK_member_relationship_id]
6887 GO
6888
6889
6890
6891ALTER TABLE [dbo].[member_relationship]
6892 ADD CONSTRAINT [PK_member_relationship_id]
6893 PRIMARY KEY
6894 CLUSTERED ([id] ASC)
6895
6896GO
6897
6898IF 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'))
6899ALTER TABLE [dbo].[message] DROP CONSTRAINT [PK_message_id]
6900 GO
6901
6902
6903
6904ALTER TABLE [dbo].[message]
6905 ADD CONSTRAINT [PK_message_id]
6906 PRIMARY KEY
6907 CLUSTERED ([id] ASC)
6908
6909GO
6910
6911IF 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'))
6912ALTER TABLE [dbo].[message_file] DROP CONSTRAINT [PK_message_file_id]
6913 GO
6914
6915
6916
6917ALTER TABLE [dbo].[message_file]
6918 ADD CONSTRAINT [PK_message_file_id]
6919 PRIMARY KEY
6920 CLUSTERED ([id] ASC)
6921
6922GO
6923
6924IF 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'))
6925ALTER TABLE [dbo].[message_send_list] DROP CONSTRAINT [PK_message_send_list_id]
6926 GO
6927
6928
6929
6930ALTER TABLE [dbo].[message_send_list]
6931 ADD CONSTRAINT [PK_message_send_list_id]
6932 PRIMARY KEY
6933 CLUSTERED ([id] ASC)
6934
6935GO
6936
6937IF 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'))
6938ALTER TABLE [dbo].[message_type] DROP CONSTRAINT [PK_message_type_id]
6939 GO
6940
6941
6942
6943ALTER TABLE [dbo].[message_type]
6944 ADD CONSTRAINT [PK_message_type_id]
6945 PRIMARY KEY
6946 CLUSTERED ([id] ASC)
6947
6948GO
6949
6950IF 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'))
6951ALTER TABLE [dbo].[message_type_translation] DROP CONSTRAINT [PK_message_type_translation_id]
6952 GO
6953
6954
6955
6956ALTER TABLE [dbo].[message_type_translation]
6957 ADD CONSTRAINT [PK_message_type_translation_id]
6958 PRIMARY KEY
6959 CLUSTERED ([id] ASC, [lang] ASC)
6960
6961GO
6962
6963IF 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'))
6964ALTER TABLE [dbo].[navigation] DROP CONSTRAINT [PK_navigation_id]
6965 GO
6966
6967
6968
6969ALTER TABLE [dbo].[navigation]
6970 ADD CONSTRAINT [PK_navigation_id]
6971 PRIMARY KEY
6972 CLUSTERED ([id] ASC)
6973
6974GO
6975
6976IF 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'))
6977ALTER TABLE [dbo].[navigation_translation] DROP CONSTRAINT [PK_navigation_translation_id]
6978 GO
6979
6980
6981
6982ALTER TABLE [dbo].[navigation_translation]
6983 ADD CONSTRAINT [PK_navigation_translation_id]
6984 PRIMARY KEY
6985 CLUSTERED ([id] ASC, [lang] ASC)
6986
6987GO
6988
6989IF 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'))
6990ALTER TABLE [dbo].[notification_mail] DROP CONSTRAINT [PK_notification_mail_id]
6991 GO
6992
6993
6994
6995ALTER TABLE [dbo].[notification_mail]
6996 ADD CONSTRAINT [PK_notification_mail_id]
6997 PRIMARY KEY
6998 CLUSTERED ([id] ASC)
6999
7000GO
7001
7002IF 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'))
7003ALTER TABLE [dbo].[notification_mail_translation] DROP CONSTRAINT [PK_notification_mail_translation_id]
7004 GO
7005
7006
7007
7008ALTER TABLE [dbo].[notification_mail_translation]
7009 ADD CONSTRAINT [PK_notification_mail_translation_id]
7010 PRIMARY KEY
7011 CLUSTERED ([id] ASC, [lang] ASC)
7012
7013GO
7014
7015IF 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'))
7016ALTER TABLE [dbo].[o_auth_admin_token] DROP CONSTRAINT [PK_o_auth_admin_token_id]
7017 GO
7018
7019
7020
7021ALTER TABLE [dbo].[o_auth_admin_token]
7022 ADD CONSTRAINT [PK_o_auth_admin_token_id]
7023 PRIMARY KEY
7024 CLUSTERED ([id] ASC)
7025
7026GO
7027
7028IF 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'))
7029ALTER TABLE [dbo].[o_auth_member_token] DROP CONSTRAINT [PK_o_auth_member_token_id]
7030 GO
7031
7032
7033
7034ALTER TABLE [dbo].[o_auth_member_token]
7035 ADD CONSTRAINT [PK_o_auth_member_token_id]
7036 PRIMARY KEY
7037 CLUSTERED ([id] ASC)
7038
7039GO
7040
7041IF 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'))
7042ALTER TABLE [dbo].[oauth_consumer] DROP CONSTRAINT [PK_oauth_consumer_id]
7043 GO
7044
7045
7046
7047ALTER TABLE [dbo].[oauth_consumer]
7048 ADD CONSTRAINT [PK_oauth_consumer_id]
7049 PRIMARY KEY
7050 CLUSTERED ([id] ASC)
7051
7052GO
7053
7054IF 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'))
7055ALTER TABLE [dbo].[openid_trust_log] DROP CONSTRAINT [PK_openid_trust_log_id]
7056 GO
7057
7058
7059
7060ALTER TABLE [dbo].[openid_trust_log]
7061 ADD CONSTRAINT [PK_openid_trust_log_id]
7062 PRIMARY KEY
7063 CLUSTERED ([id] ASC)
7064
7065GO
7066
7067IF 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'))
7068ALTER TABLE [dbo].[plugin] DROP CONSTRAINT [PK_plugin_id]
7069 GO
7070
7071
7072
7073ALTER TABLE [dbo].[plugin]
7074 ADD CONSTRAINT [PK_plugin_id]
7075 PRIMARY KEY
7076 CLUSTERED ([id] ASC)
7077
7078GO
7079
7080IF 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'))
7081ALTER TABLE [dbo].[profile] DROP CONSTRAINT [PK_profile_id]
7082 GO
7083
7084
7085
7086ALTER TABLE [dbo].[profile]
7087 ADD CONSTRAINT [PK_profile_id]
7088 PRIMARY KEY
7089 CLUSTERED ([id] ASC)
7090
7091GO
7092
7093IF 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'))
7094ALTER TABLE [dbo].[profile_option] DROP CONSTRAINT [PK_profile_option_id]
7095 GO
7096
7097
7098
7099ALTER TABLE [dbo].[profile_option]
7100 ADD CONSTRAINT [PK_profile_option_id]
7101 PRIMARY KEY
7102 CLUSTERED ([id] ASC)
7103
7104GO
7105
7106IF 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'))
7107ALTER TABLE [dbo].[profile_option_translation] DROP CONSTRAINT [PK_profile_option_translation_id]
7108 GO
7109
7110
7111
7112ALTER TABLE [dbo].[profile_option_translation]
7113 ADD CONSTRAINT [PK_profile_option_translation_id]
7114 PRIMARY KEY
7115 CLUSTERED ([id] ASC, [lang] ASC)
7116
7117GO
7118
7119IF 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'))
7120ALTER TABLE [dbo].[profile_translation] DROP CONSTRAINT [PK_profile_translation_id]
7121 GO
7122
7123
7124
7125ALTER TABLE [dbo].[profile_translation]
7126 ADD CONSTRAINT [PK_profile_translation_id]
7127 PRIMARY KEY
7128 CLUSTERED ([id] ASC, [lang] ASC)
7129
7130GO
7131
7132IF 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'))
7133ALTER TABLE [dbo].[session] DROP CONSTRAINT [PK_session_id]
7134 GO
7135
7136
7137
7138ALTER TABLE [dbo].[session]
7139 ADD CONSTRAINT [PK_session_id]
7140 PRIMARY KEY
7141 CLUSTERED ([id] ASC)
7142
7143GO
7144
7145IF 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'))
7146ALTER TABLE [dbo].[skin_config] DROP CONSTRAINT [PK_skin_config_id]
7147 GO
7148
7149
7150
7151ALTER TABLE [dbo].[skin_config]
7152 ADD CONSTRAINT [PK_skin_config_id]
7153 PRIMARY KEY
7154 CLUSTERED ([id] ASC)
7155
7156GO
7157
7158IF 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'))
7159ALTER TABLE [dbo].[sns_config] DROP CONSTRAINT [PK_sns_config_id]
7160 GO
7161
7162
7163
7164ALTER TABLE [dbo].[sns_config]
7165 ADD CONSTRAINT [PK_sns_config_id]
7166 PRIMARY KEY
7167 CLUSTERED ([id] ASC)
7168
7169GO
7170
7171IF 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'))
7172ALTER TABLE [dbo].[sns_term] DROP CONSTRAINT [PK_sns_term_id]
7173 GO
7174
7175
7176
7177ALTER TABLE [dbo].[sns_term]
7178 ADD CONSTRAINT [PK_sns_term_id]
7179 PRIMARY KEY
7180 CLUSTERED ([id] ASC)
7181
7182GO
7183
7184IF 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'))
7185ALTER TABLE [dbo].[sns_term_translation] DROP CONSTRAINT [PK_sns_term_translation_id]
7186 GO
7187
7188
7189
7190ALTER TABLE [dbo].[sns_term_translation]
7191 ADD CONSTRAINT [PK_sns_term_translation_id]
7192 PRIMARY KEY
7193 CLUSTERED ([id] ASC, [lang] ASC)
7194
7195GO
7196
7197IF 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'))
7198ALTER TABLE [dbo].[admin_user] DROP CONSTRAINT [admin_user$username_UNIQUE_idx]
7199 GO
7200
7201
7202
7203ALTER TABLE [dbo].[admin_user]
7204 ADD CONSTRAINT [admin_user$username_UNIQUE_idx]
7205 UNIQUE
7206 NONCLUSTERED ([username] ASC)
7207
7208GO
7209
7210IF 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'))
7211ALTER TABLE [dbo].[application_persistent_data] DROP CONSTRAINT [application_persistent_data$name_UNIQUE_idx]
7212 GO
7213
7214
7215
7216ALTER 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
7221GO
7222
7223IF 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'))
7224ALTER TABLE [dbo].[banner] DROP CONSTRAINT [banner$name_UNIQUE_idx]
7225 GO
7226
7227
7228
7229ALTER TABLE [dbo].[banner]
7230 ADD CONSTRAINT [banner$name_UNIQUE_idx]
7231 UNIQUE
7232 NONCLUSTERED ([name] ASC)
7233
7234GO
7235
7236IF 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'))
7237ALTER TABLE [dbo].[blacklist] DROP CONSTRAINT [blacklist$uid_UNIQUE_idx]
7238 GO
7239
7240
7241
7242ALTER TABLE [dbo].[blacklist]
7243 ADD CONSTRAINT [blacklist$uid_UNIQUE_idx]
7244 UNIQUE
7245 NONCLUSTERED ([uid] ASC)
7246
7247GO
7248
7249IF 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'))
7250ALTER TABLE [dbo].[community] DROP CONSTRAINT [community$name_UNIQUE_idx]
7251 GO
7252
7253
7254
7255ALTER TABLE [dbo].[community]
7256 ADD CONSTRAINT [community$name_UNIQUE_idx]
7257 UNIQUE
7258 NONCLUSTERED ([name] ASC)
7259
7260GO
7261
7262IF 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'))
7263ALTER TABLE [dbo].[community_event_comment_image] DROP CONSTRAINT [community_event_comment_image$id_number_idx]
7264 GO
7265
7266
7267
7268ALTER 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
7273GO
7274
7275IF 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'))
7276ALTER TABLE [dbo].[community_event_image] DROP CONSTRAINT [community_event_image$id_number_idx]
7277 GO
7278
7279
7280
7281ALTER TABLE [dbo].[community_event_image]
7282 ADD CONSTRAINT [community_event_image$id_number_idx]
7283 UNIQUE
7284 NONCLUSTERED ([id] ASC, [number] ASC)
7285
7286GO
7287
7288IF 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'))
7289ALTER TABLE [dbo].[community_member_position] DROP CONSTRAINT [community_member_position$name_UNIQUE_idx]
7290 GO
7291
7292
7293
7294ALTER 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
7299GO
7300
7301IF 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'))
7302ALTER TABLE [dbo].[community_topic_comment_image] DROP CONSTRAINT [community_topic_comment_image$id_number_idx]
7303 GO
7304
7305
7306
7307ALTER 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
7312GO
7313
7314IF 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'))
7315ALTER TABLE [dbo].[community_topic_image] DROP CONSTRAINT [community_topic_image$id_number_idx]
7316 GO
7317
7318
7319
7320ALTER TABLE [dbo].[community_topic_image]
7321 ADD CONSTRAINT [community_topic_image$id_number_idx]
7322 UNIQUE
7323 NONCLUSTERED ([id] ASC, [number] ASC)
7324
7325GO
7326
7327IF 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'))
7328ALTER TABLE [dbo].[diary_image] DROP CONSTRAINT [diary_image$diary_id_number_idx]
7329 GO
7330
7331
7332
7333ALTER TABLE [dbo].[diary_image]
7334 ADD CONSTRAINT [diary_image$diary_id_number_idx]
7335 UNIQUE
7336 NONCLUSTERED ([diary_id] ASC, [number] ASC)
7337
7338GO
7339
7340IF 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'))
7341ALTER TABLE [dbo].[file] DROP CONSTRAINT [file$name_UNIQUE_idx]
7342 GO
7343
7344
7345
7346ALTER TABLE [dbo].[file]
7347 ADD CONSTRAINT [file$name_UNIQUE_idx]
7348 UNIQUE
7349 NONCLUSTERED ([name] ASC)
7350
7351GO
7352
7353IF 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'))
7354ALTER TABLE [dbo].[member_application_setting] DROP CONSTRAINT [member_application_setting$hash_UNIQUE_idx]
7355 GO
7356
7357
7358
7359ALTER TABLE [dbo].[member_application_setting]
7360 ADD CONSTRAINT [member_application_setting$hash_UNIQUE_idx]
7361 UNIQUE
7362 NONCLUSTERED ([hash] ASC)
7363
7364GO
7365
7366IF 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'))
7367ALTER TABLE [dbo].[member_relationship] DROP CONSTRAINT [member_relationship$member_id_to_from_UNIQUE_idx]
7368 GO
7369
7370
7371
7372ALTER 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
7377GO
7378
7379IF 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'))
7380ALTER TABLE [dbo].[member_relationship] DROP CONSTRAINT [member_relationship$member_id_from_to_UNIQUE_idx]
7381 GO
7382
7383
7384
7385ALTER 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
7390GO
7391
7392IF 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'))
7393ALTER TABLE [dbo].[notification_mail] DROP CONSTRAINT [notification_mail$name_UNIQUE_idx]
7394 GO
7395
7396
7397
7398ALTER TABLE [dbo].[notification_mail]
7399 ADD CONSTRAINT [notification_mail$name_UNIQUE_idx]
7400 UNIQUE
7401 NONCLUSTERED ([name] ASC)
7402
7403GO
7404
7405IF 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'))
7406ALTER TABLE [dbo].[o_auth_admin_token] DROP CONSTRAINT [o_auth_admin_token$key_secret_UNIQUE_idx]
7407 GO
7408
7409
7410
7411ALTER 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
7416GO
7417
7418IF 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'))
7419ALTER TABLE [dbo].[o_auth_member_token] DROP CONSTRAINT [o_auth_member_token$key_secret_UNIQUE_idx]
7420 GO
7421
7422
7423
7424ALTER 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
7429GO
7430
7431IF 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'))
7432ALTER TABLE [dbo].[oauth_consumer] DROP CONSTRAINT [oauth_consumer$key_secret_UNIQUE_idx]
7433 GO
7434
7435
7436
7437ALTER TABLE [dbo].[oauth_consumer]
7438 ADD CONSTRAINT [oauth_consumer$key_secret_UNIQUE_idx]
7439 UNIQUE
7440 NONCLUSTERED ([key_string] ASC, [secret] ASC)
7441
7442GO
7443
7444IF 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'))
7445ALTER TABLE [dbo].[plugin] DROP CONSTRAINT [plugin$name_UNIQUE_idx]
7446 GO
7447
7448
7449
7450ALTER TABLE [dbo].[plugin]
7451 ADD CONSTRAINT [plugin$name_UNIQUE_idx]
7452 UNIQUE
7453 NONCLUSTERED ([name] ASC)
7454
7455GO
7456
7457IF 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'))
7458ALTER TABLE [dbo].[profile] DROP CONSTRAINT [profile$name_UNIQUE_idx]
7459 GO
7460
7461
7462
7463ALTER TABLE [dbo].[profile]
7464 ADD CONSTRAINT [profile$name_UNIQUE_idx]
7465 UNIQUE
7466 NONCLUSTERED ([name] ASC)
7467
7468GO
7469
7470IF 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'))
7471ALTER TABLE [dbo].[skin_config] DROP CONSTRAINT [skin_config$plugin_name_UNIQUE_idx]
7472 GO
7473
7474
7475
7476ALTER TABLE [dbo].[skin_config]
7477 ADD CONSTRAINT [skin_config$plugin_name_UNIQUE_idx]
7478 UNIQUE
7479 NONCLUSTERED ([plugin] ASC, [name] ASC)
7480
7481GO
7482
7483IF 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'))
7484ALTER TABLE [dbo].[sns_config] DROP CONSTRAINT [sns_config$name_UNIQUE_idx]
7485 GO
7486
7487
7488
7489ALTER TABLE [dbo].[sns_config]
7490 ADD CONSTRAINT [sns_config$name_UNIQUE_idx]
7491 UNIQUE
7492 NONCLUSTERED ([name] ASC)
7493
7494GO
7495
7496IF 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]
7503GO