Migration for meal plan storage

This commit is contained in:
Jeremy Wall 2022-10-30 14:29:19 -04:00
parent 79913096fb
commit 496e633034
3 changed files with 11 additions and 2 deletions

View File

@ -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)

View File

@ -0,0 +1,3 @@
-- Add down migration script here
drop table plans;
drop table plan_recipes;

View File

@ -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);