You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
688 B

#!/bin/sh
epoch="$(date +%s)"
[ -f $1 ] && echo "Please provide a name for the migration" && exit 1
migration_name=$1
migration=${epoch}_${migration_name}
$(cat <<EOF > db/migrations/$migration.h
#pragma once
namespace db {
namespace migrations {
namespace db_builder = db::migrations::builder;
class m$migration : public Migration {
public:
m$migration() : Migration() {
db_builder::Table $migration_name = db_builder::Table::
m_statement = $migration_name.str();
}
};
}
}
EOF
)
include="#include \"migrations/$migration.h\""
map_entry="migrations.emplace($epoch, new db::migrations::m$migration());"
echo $include
echo $map_entry