#!/usr/bin/env perl # Dev-only startup gate: refuses to start the app server if the database # schema doesn't match what the code expects, instead of silently running # against a stale database (or auto-migrating one that might be shared). # See bin/startdev.sh and Lacuna::DB::Migrate. Exits non-zero if a migration # is pending. use 5.010; use strict; use lib '/home/lacuna/server/lib'; use Lacuna::DB::Migrate; if (Lacuna::DB::Migrate::pending()) { my $schema_version = Lacuna::DB::Migrate::schema_version(); my $db_version = Lacuna::DB::Migrate::database_version(); say STDERR '=' x 70; say STDERR 'Database schema is out of date -- refusing to start.'; say STDERR " code expects version: $schema_version"; say STDERR ' database is at version: ' . (defined $db_version ? $db_version : '(not installed)'); say STDERR ''; say STDERR 'Run bin/migrate_db.pl to bring the database up to date.'; say STDERR '=' x 70; exit 1; }