Skip to content
Tapper team edited this page Mar 11, 2016 · 4 revisions

How to tweak the "create table" statements when creating a new database

Overview

  1. dump create table statements as DBIx::Class (the Object-Relational-Mapper library) would use them
  2. modify thoat SQL dump to your needs
  3. execute that modified SQL against your database
  4. initialize Tapper with tapper init --default but skip its table creation part for the testrundb

Step 0 - Preparations

You should have installed all Tapper modules, e.g., by following the HelloWorld instructions.

Step 1 - Dump the "create tables" SQL

mkdir -p /tmp/my-tweaked-tapper-tables
cd /tmp/my-tweaked-tapper-tables
perl -MTapper::Schema::TestrunDB -MTapper::Model=model -e 'model->create_ddl_dir([qw/MySQL SQLite/], undef, "./")'

Step 2 - Modify the create statements

vi Tapper-Schema-TestrunDB-4.001043-MySQL.sql
# patch manually whatever you consider important

Remember that the relational structure, constraints, etc. should still match the schema as defined in Tapper::Schema::TestrunDB.

Step 3 - Create DB

  $ mysql -u root -p
  $ mysql> drop database testrundb;
  $ mysql> create database if not exists testrundb;
    mysql> grant all on `testrundb`.* to `tapper`@localhost identified by 'verysecret';
    mysql> quit;

Modify these statements to your needs, e.g., for using UTF-8.

Step 4 - Create tables using the modified SQL

mysql -u tapper -pverysecret testrundb < Tapper-Schema-TestrunDB-4.001043-MySQL.sql

Quick Links

About

Release changelogs

  • 5.0 2016-03 "Max Headroom"
  • 4.1 2012-10 "Cagney&Lacey"
  • 4.0 2012-05 "Columbo"
  • 3.0 2011-03 - public release
  • 2.0 2008-12 "Lastwagenkrieg"
  • 1.0 2007-12 - internal prototype

Development

Clone this wiki locally