diff options
Diffstat (limited to 'migrate')
-rw-r--r-- | migrate/buildfile | 5 | ||||
-rw-r--r-- | migrate/migrate.cli | 5 | ||||
-rw-r--r-- | migrate/migrate.cxx | 39 |
3 files changed, 36 insertions, 13 deletions
diff --git a/migrate/buildfile b/migrate/buildfile index 0fd6558..0480cc6 100644 --- a/migrate/buildfile +++ b/migrate/buildfile @@ -1,5 +1,4 @@ # file : migrate/buildfile -# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file import libs = libodb%lib{odb} @@ -12,6 +11,10 @@ exe{brep-migrate}: {hxx ixx cxx}{* -migrate-options} \ {hxx ixx cxx}{ migrate-options} \ ../libbrep/lib{brep} $libs +# Build options. +# +obj{migrate}: cxx.poptions += -DBREP_COPYRIGHT=\"$copyright\" + # Generated options parser. # if $cli.configured diff --git a/migrate/migrate.cli b/migrate/migrate.cli index 52d31cc..177f991 100644 --- a/migrate/migrate.cli +++ b/migrate/migrate.cli @@ -1,5 +1,4 @@ // file : migrate/migrate.cli -// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file include <vector>; @@ -126,8 +125,8 @@ Fatal error.| \li|\cb{2} -An instance of \cb{brep-migrate} or \l{brep-load(1)} is already running. Try -again.| +An instance of \cb{brep-migrate} or some other \cb{brep} utility is already +running. Try again.| \li|\cb{3} diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx index c1f4dc1..090fcac 100644 --- a/migrate/migrate.cxx +++ b/migrate/migrate.cxx @@ -1,5 +1,4 @@ // file : migrate/migrate.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #include <strings.h> // strcasecmp() @@ -13,8 +12,10 @@ #include <odb/pgsql/database.hxx> -#include <libbutl/pager.mxx> +#include <libbutl/pager.hxx> +#include <libbrep/build.hxx> +#include <libbrep/build-odb.hxx> #include <libbrep/package.hxx> #include <libbrep/package-odb.hxx> #include <libbrep/database-lock.hxx> @@ -114,7 +115,7 @@ schema (const char* s, string name) string kw; i >> kw; - statement += " " + kw; + statement += ' ' + kw; if (strcasecmp (kw.c_str (), "FUNCTION") == 0) { @@ -132,7 +133,7 @@ schema (const char* s, string name) else if (strcasecmp (kw.c_str (), "FOREIGN") == 0) { i >> kw; - statement += " " + kw; + statement += ' ' + kw; valid = strcasecmp (kw.c_str (), "TABLE") == 0; // Fall through. @@ -219,8 +220,28 @@ struct package_migration_entry: package_migration_entry_base<v> : package_migration_entry_base<v> (f, "package") {} }; -static const package_migration_entry<18> -package_migrate_v18 ([] (database& db) +static const package_migration_entry<26> +package_migrate_v26 ([] (database& db) +{ +}); +#endif + +// Register the data migration functions for the build database schema. +// +#if 0 +template <schema_version v> +using build_migration_entry_base = + data_migration_entry<v, LIBBREP_BUILD_SCHEMA_VERSION_BASE>; + +template <schema_version v> +struct build_migration_entry: build_migration_entry_base<v> +{ + build_migration_entry (void (*f) (database& db)) + : build_migration_entry_base<v> (f, "build") {} +}; + +static const build_migration_entry<19> +build_migrate_v19 ([] (database& db) { }); #endif @@ -243,7 +264,7 @@ try << "libbbot " << LIBBBOT_VERSION_ID << endl << "libbpkg " << LIBBPKG_VERSION_ID << endl << "libbutl " << LIBBUTL_VERSION_ID << endl - << "Copyright (c) 2014-2019 Code Synthesis Ltd" << endl + << "Copyright (c) " << BREP_COPYRIGHT << "." << endl << "This is free software released under the MIT license." << endl; return 0; @@ -301,12 +322,12 @@ try ops.db_port (), "options='-c default_transaction_isolation=serializable'"); - // Prevent several brep-migrate/load instances from updating DB + // Prevent several brep utility instances from updating the database // simultaneously. // database_lock l (db); - // Currently we don't support data migration for the manual database scheme + // Currently we don't support data migration for the manual database schema // migration. // if (db.schema_migration (db_schema)) |