|
| 1 | +using System; |
| 2 | +using Microsoft.EntityFrameworkCore.Migrations; |
| 3 | + |
| 4 | +#nullable disable |
| 5 | + |
| 6 | +namespace sparkly_server.Migrations |
| 7 | +{ |
| 8 | + /// <inheritdoc /> |
| 9 | + public partial class Default_value_for_visibility : Migration |
| 10 | + { |
| 11 | + /// <inheritdoc /> |
| 12 | + protected override void Up(MigrationBuilder migrationBuilder) |
| 13 | + { |
| 14 | + migrationBuilder.CreateTable( |
| 15 | + name: "projects", |
| 16 | + columns: table => new |
| 17 | + { |
| 18 | + Id = table.Column<Guid>(type: "uuid", nullable: false), |
| 19 | + ProjectName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false), |
| 20 | + Description = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false), |
| 21 | + Slug = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false), |
| 22 | + CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
| 23 | + OwnerId = table.Column<Guid>(type: "uuid", nullable: false), |
| 24 | + UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
| 25 | + Visibility = table.Column<int>(type: "integer", nullable: false, defaultValue: 0) |
| 26 | + }, |
| 27 | + constraints: table => |
| 28 | + { |
| 29 | + table.PrimaryKey("PK_projects", x => x.Id); |
| 30 | + }); |
| 31 | + |
| 32 | + migrationBuilder.CreateTable( |
| 33 | + name: "project_members", |
| 34 | + columns: table => new |
| 35 | + { |
| 36 | + MembersId = table.Column<Guid>(type: "uuid", nullable: false), |
| 37 | + ProjectsId = table.Column<Guid>(type: "uuid", nullable: false) |
| 38 | + }, |
| 39 | + constraints: table => |
| 40 | + { |
| 41 | + table.PrimaryKey("PK_project_members", x => new { x.MembersId, x.ProjectsId }); |
| 42 | + table.ForeignKey( |
| 43 | + name: "FK_project_members_projects_ProjectsId", |
| 44 | + column: x => x.ProjectsId, |
| 45 | + principalTable: "projects", |
| 46 | + principalColumn: "Id", |
| 47 | + onDelete: ReferentialAction.Cascade); |
| 48 | + table.ForeignKey( |
| 49 | + name: "FK_project_members_users_MembersId", |
| 50 | + column: x => x.MembersId, |
| 51 | + principalTable: "users", |
| 52 | + principalColumn: "Id", |
| 53 | + onDelete: ReferentialAction.Cascade); |
| 54 | + }); |
| 55 | + |
| 56 | + migrationBuilder.CreateIndex( |
| 57 | + name: "IX_project_members_ProjectsId", |
| 58 | + table: "project_members", |
| 59 | + column: "ProjectsId"); |
| 60 | + } |
| 61 | + |
| 62 | + /// <inheritdoc /> |
| 63 | + protected override void Down(MigrationBuilder migrationBuilder) |
| 64 | + { |
| 65 | + migrationBuilder.DropTable( |
| 66 | + name: "project_members"); |
| 67 | + |
| 68 | + migrationBuilder.DropTable( |
| 69 | + name: "projects"); |
| 70 | + } |
| 71 | + } |
| 72 | +} |
0 commit comments