File tree 10 files changed +36
-36
lines changed
diesel_cli/tests/generate_migrations/diff_add_table_with_fk
10 files changed +36
-36
lines changed Original file line number Diff line number Diff line change 1
1
CREATE TABLE `users `(
2
- ` id ` INTEGER NOT NULL PRIMARY KEY ,
2
+ ` user_id ` INTEGER NOT NULL PRIMARY KEY ,
3
3
` name` TEXT NOT NULL
4
4
);
Original file line number Diff line number Diff line change @@ -6,21 +6,21 @@ description: "Test: diff_add_table_with_fk"
6
6
// @generated automatically by Diesel CLI.
7
7
8
8
diesel ::table ! {
9
- posts (id ) {
10
- id - > Integer ,
9
+ posts (post_id ) {
10
+ post_id - > Integer ,
11
11
title - > Text ,
12
12
body - > Nullable <Text >,
13
- user_id -> Integer,
13
+ foreign_key_user_id -> Integer,
14
14
}
15
15
}
16
16
17
17
diesel::table! {
18
- users (id ) {
19
- id -> Integer ,
18
+ users (user_id ) {
19
+ user_id -> Integer ,
20
20
name -> Text ,
21
21
}
22
22
}
23
23
24
- diesel::joinable!(posts -> users (user_id ));
24
+ diesel::joinable!(posts -> users (foreign_key_user_id ));
25
25
26
26
diesel::allow_tables_to_appear_in_same_query!(posts, users,);
Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ description: "Test: diff_add_table_with_fk"
6
6
-- Your SQL goes here
7
7
8
8
CREATE TABLE ` posts` (
9
- ` id ` INTEGER NOT NULL PRIMARY KEY ,
9
+ ` post_id ` INTEGER NOT NULL PRIMARY KEY ,
10
10
` title` TEXT NOT NULL ,
11
11
` body` TEXT ,
12
- ` user_id ` INTEGER NOT NULL ,
13
- FOREIGN KEY (` user_id ` ) REFERENCES ` users` (` id ` )
12
+ ` foreign_key_user_id ` INTEGER NOT NULL ,
13
+ FOREIGN KEY (` foreign_key_user_id ` ) REFERENCES ` users` (` user_id ` )
14
14
);
15
15
16
16
Original file line number Diff line number Diff line change 1
1
CREATE TABLE "users "(
2
- " id " INTEGER NOT NULL PRIMARY KEY ,
2
+ " user_id " INTEGER NOT NULL PRIMARY KEY ,
3
3
" name" TEXT NOT NULL
4
4
);
Original file line number Diff line number Diff line change @@ -6,21 +6,21 @@ snapshot_kind: text
6
6
// @generated automatically by Diesel CLI.
7
7
8
8
diesel ::table ! {
9
- posts (id ) {
10
- id - > Int4 ,
9
+ posts (post_id ) {
10
+ post_id - > Int4 ,
11
11
title - > Text ,
12
12
body - > Nullable <Text >,
13
- user_id -> Int4,
13
+ foreign_key_user_id -> Int4,
14
14
}
15
15
}
16
16
17
17
diesel::table! {
18
- users (id ) {
19
- id -> Int4 ,
18
+ users (user_id ) {
19
+ user_id -> Int4 ,
20
20
name -> Text ,
21
21
}
22
22
}
23
23
24
- diesel::joinable!(posts -> users (user_id ));
24
+ diesel::joinable!(posts -> users (foreign_key_user_id ));
25
25
26
26
diesel::allow_tables_to_appear_in_same_query!(posts, users,);
Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ description: "Test: diff_add_table_with_fk"
6
6
-- Your SQL goes here
7
7
8
8
CREATE TABLE " posts" (
9
- " id " INTEGER NOT NULL PRIMARY KEY ,
9
+ " post_id " INTEGER NOT NULL PRIMARY KEY ,
10
10
" title" TEXT NOT NULL ,
11
11
" body" TEXT ,
12
- " user_id " INTEGER NOT NULL ,
13
- FOREIGN KEY (" user_id " ) REFERENCES " users" (" id " )
12
+ " foreign_key_user_id " INTEGER NOT NULL ,
13
+ FOREIGN KEY (" foreign_key_user_id " ) REFERENCES " users" (" user_id " )
14
14
);
15
15
16
16
Original file line number Diff line number Diff line change 1
1
diesel:: table! {
2
- users {
3
- id -> Integer ,
2
+ users( user_id ) {
3
+ user_id -> Integer ,
4
4
name -> Text ,
5
5
}
6
6
}
7
7
8
8
diesel:: table! {
9
- posts {
10
- id -> Integer ,
9
+ posts( post_id ) {
10
+ post_id -> Integer ,
11
11
title -> Text ,
12
12
body -> Nullable <Text >,
13
- user_id -> Integer ,
13
+ foreign_key_user_id -> Integer ,
14
14
}
15
15
}
16
16
17
- diesel:: joinable!( posts -> users ( user_id ) ) ;
17
+ diesel:: joinable!( posts -> users ( foreign_key_user_id ) ) ;
Original file line number Diff line number Diff line change 1
1
CREATE TABLE `users `(
2
- ` id ` INTEGER NOT NULL PRIMARY KEY ,
2
+ ` user_id ` INTEGER NOT NULL PRIMARY KEY ,
3
3
` name` TEXT NOT NULL
4
4
);
Original file line number Diff line number Diff line change @@ -6,21 +6,21 @@ snapshot_kind: text
6
6
// @generated automatically by Diesel CLI.
7
7
8
8
diesel ::table ! {
9
- posts (id ) {
10
- id - > Integer ,
9
+ posts (post_id ) {
10
+ post_id - > Integer ,
11
11
title - > Text ,
12
12
body - > Nullable <Text >,
13
- user_id -> Integer,
13
+ foreign_key_user_id -> Integer,
14
14
}
15
15
}
16
16
17
17
diesel::table! {
18
- users (id ) {
19
- id -> Integer ,
18
+ users (user_id ) {
19
+ user_id -> Integer ,
20
20
name -> Text ,
21
21
}
22
22
}
23
23
24
- diesel::joinable!(posts -> users (user_id ));
24
+ diesel::joinable!(posts -> users (foreign_key_user_id ));
25
25
26
26
diesel::allow_tables_to_appear_in_same_query!(posts, users,);
Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ description: "Test: diff_add_table_with_fk"
6
6
-- Your SQL goes here
7
7
8
8
CREATE TABLE ` posts` (
9
- ` id ` INTEGER NOT NULL PRIMARY KEY ,
9
+ ` post_id ` INTEGER NOT NULL PRIMARY KEY ,
10
10
` title` TEXT NOT NULL ,
11
11
` body` TEXT ,
12
- ` user_id ` INTEGER NOT NULL ,
13
- FOREIGN KEY (` user_id ` ) REFERENCES ` users` (` id ` )
12
+ ` foreign_key_user_id ` INTEGER NOT NULL ,
13
+ FOREIGN KEY (` foreign_key_user_id ` ) REFERENCES ` users` (` user_id ` )
14
14
);
15
15
16
16
You can’t perform that action at this time.
0 commit comments