Skip to content

Commit

Permalink
feat: answersテーブルにform_idカラムを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
rito528 committed Sep 16, 2023
1 parent 4eff579 commit bb7d8c9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/migration/src/m20230811_062425_create_answer_tables.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::m20220101_000001_create_table::FormMetaDataTable;
use sea_orm_migration::prelude::*;

use crate::m20221211_211233_form_questions::FormQuestionsTable;
Expand All @@ -20,6 +21,13 @@ impl MigrationTrait for Migration {
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(AnswersTable::FormId).integer().not_null())
.foreign_key(
ForeignKey::create()
.name("fk-form-id-from-answers")
.from(AnswersTable::Answers, AnswersTable::FormId)
.to(FormMetaDataTable::FormMetaData, FormMetaDataTable::Id),
)
.col(ColumnDef::new(AnswersTable::User).uuid().not_null())
.col(
ColumnDef::new(AnswersTable::Title)
Expand Down Expand Up @@ -98,6 +106,7 @@ impl MigrationTrait for Migration {
enum AnswersTable {
Answers,
Id,
FormId,
User,
Title,
TimeStamp,
Expand Down

0 comments on commit bb7d8c9

Please sign in to comment.