diff --git a/Makefile b/Makefile index 56120ea..4604483 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_dir := $(dir $(mkfile_path)) +sqlite_url := sqlite://$(mkfile_dir)/.session_store/store.db kitchen: wasm kitchen/src/*.rs cd kitchen; cargo build @@ -40,5 +40,8 @@ clean: rm -rf web/dist/* cargo clean +sqlx-migrate: + cd kitchen; cargo sqlx migrate run --database-url $(sqlite_url) + sqlx-prepare: - cd kitchen; cargo sqlx prepare --database-url sqlite://$(mkfile_dir)/.session_store/store.db + cd kitchen; cargo sqlx prepare --database-url $(sqlite_url) diff --git a/kitchen/migrations/20221030222458_mealplans_v0.down.sql b/kitchen/migrations/20221030222458_mealplans_v0.down.sql new file mode 100644 index 0000000..c32f8de --- /dev/null +++ b/kitchen/migrations/20221030222458_mealplans_v0.down.sql @@ -0,0 +1,3 @@ +-- Add down migration script here +drop table plans; +drop table plan_recipes; \ No newline at end of file diff --git a/kitchen/migrations/20221030222458_mealplans_v0.up.sql b/kitchen/migrations/20221030222458_mealplans_v0.up.sql new file mode 100644 index 0000000..e06d773 --- /dev/null +++ b/kitchen/migrations/20221030222458_mealplans_v0.up.sql @@ -0,0 +1,3 @@ +-- Add up migration script here +CREATE TABLE plans(id NUMBER, user_id TEXT, date TEXT); +CREATE table plan_recipes(plan_id NUMBER, recipe_id TEXT); \ No newline at end of file