new schema to contain basic channel information
This commit is contained in:
parent
8ae877f3f9
commit
7e04e6010a
2
server/migrations/2020-03-11-005217_channels/down.sql
Normal file
2
server/migrations/2020-03-11-005217_channels/down.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
-- This file should undo anything in `up.sql`
|
||||||
|
DROP TABLE `channels`;
|
7
server/migrations/2020-03-11-005217_channels/up.sql
Normal file
7
server/migrations/2020-03-11-005217_channels/up.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
-- i32, String, i32
|
||||||
|
CREATE TABLE IF NOT EXISTS `channels` (
|
||||||
|
`id` INTEGER NOT NULL auto_increment,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`permissions` INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY(`id`)
|
||||||
|
);
|
@ -1,4 +1,4 @@
|
|||||||
use crate::schema::{invites, users};
|
use crate::schema::{invites, users, channels};
|
||||||
#[derive(Insertable, Serialize, Deserialize, Queryable, Debug)]
|
#[derive(Insertable, Serialize, Deserialize, Queryable, Debug)]
|
||||||
#[table_name = "invites"]
|
#[table_name = "invites"]
|
||||||
pub struct Invite {
|
pub struct Invite {
|
||||||
@ -15,3 +15,11 @@ pub struct User {
|
|||||||
pub key: String,
|
pub key: String,
|
||||||
pub date: u64,
|
pub date: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Queryable, Insertable)]
|
||||||
|
#[table_name = "channels" ]
|
||||||
|
pub struct Channel {
|
||||||
|
pub id: i32,
|
||||||
|
pub name: String,
|
||||||
|
pub permissions: i32,
|
||||||
|
}
|
@ -1,3 +1,11 @@
|
|||||||
|
table! {
|
||||||
|
channels (id) {
|
||||||
|
id -> Integer,
|
||||||
|
name -> Varchar,
|
||||||
|
permissions -> Integer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
table! {
|
table! {
|
||||||
invites (id) {
|
invites (id) {
|
||||||
id -> Unsigned<Bigint>,
|
id -> Unsigned<Bigint>,
|
||||||
@ -16,6 +24,7 @@ table! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
allow_tables_to_appear_in_same_query!(
|
allow_tables_to_appear_in_same_query!(
|
||||||
|
channels,
|
||||||
invites,
|
invites,
|
||||||
users,
|
users,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user