Skip to content

Instantly share code, notes, and snippets.

@swlkr
Created December 25, 2024 14:30
Show Gist options
  • Save swlkr/0fe594378fd1bcf7d9d21388aaa8c40a to your computer and use it in GitHub Desktop.
Save swlkr/0fe594378fd1bcf7d9d21388aaa8c40a to your computer and use it in GitHub Desktop.
sql! {
let migrations = r#"
create table User (
id integer primary key,
email text not null unique
);
create table Row (
not_null_text text not null,
not_null_integer integer not null,
not_null_real real not null,
not_null_blob blob not null,
null_text text,
null_integer integer,
null_real real,
null_blob blob
);
alter table Row add column nullable_text text;
alter table Row add column nullable_integer integer;
alter table Row add column nullable_real real;
alter table Row add column nullable_blob blob;
"#;
let insert_row = r#"
insert into Row (
not_null_text,
not_null_integer,
not_null_real,
not_null_blob,
null_text,
null_integer,
null_real,
null_blob,
nullable_text,
nullable_integer,
nullable_real,
nullable_blob
)
values (
?, ?, ?, ?,
?, ?, ?, ?,
?, ?, ?, ?
)
returning *
"#;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment