<commit_before>// Copyright 2013 the original author or authors.
// site: http://lichen.ganshane.com
package lichen.migration.testdb;

import lichen.migration.model.SqlType;
import lichen.migration.model.TableDefinition;
import lichen.migration.services.Migration;
import lichen.migration.services.MigrationHelper;
import lichen.migration.services.Options;
import lichen.migration.services.TableCallback;

import javax.inject.Inject;

/**
 * @author jcai
 */
public class Migrate_20130722093444_CreateTable implements Migration{
    @Inject
    private MigrationHelper helper;
    @Inject
    private Options options;

    @Override
    public void up() throws Throwable {
        helper.createTable("test_table",new TableCallback() {
            @Override
            public void doInTable(TableDefinition t) throws Throwable {
                t.bigint("bigint");
                t.blob("blob");
                t.bool("bool");
                t.char_("char_");
                t.column("column_", SqlType.BigintType);
                //t.decimal("decimal_",Op);
                t.integer("int_");
                t.smallint("sint_");
                t.timestamp("ts");
                t.varbinary("vb");
                t.varchar("vc");
            }
        });

        helper.addColumn("test_table","test_col",SqlType.VarcharType,options.NotNull());

    }

    @Override
    public void down() throws Throwable {
        helper.removeColumn("test_table","test_col");
        helper.dropTable("test_table");
    }
}<commit_msg>加入更多的测试方法<commit_after>// Copyright 2013 the original author or authors.
// site: http://lichen.ganshane.com
package lichen.migration.testdb;

import lichen.migration.model.SqlType;
import lichen.migration.model.TableDefinition;
import lichen.migration.services.Migration;
import lichen.migration.services.MigrationHelper;
import lichen.migration.services.Options;
import lichen.migration.services.TableCallback;

import javax.inject.Inject;

/**
 * @author jcai
 */
public class Migrate_20130722093444_CreateTable implements Migration{
    @Inject
    private MigrationHelper helper;
    @Inject
    private Options options;

    @Override
    public void up() throws Throwable {
        helper.createTable("test_table",new TableCallback() {
            @Override
            public void doInTable(TableDefinition t) throws Throwable {
                t.bigint("bigint");
                t.blob("blob");
                t.bool("bool");
                t.char_("char_");
                t.column("column_", SqlType.BigintType);
                //t.decimal("decimal_",Op);
                t.integer("int_",options.Unique());
                t.smallint("sint_");
                t.timestamp("ts");
                t.varbinary("vb");
                t.varchar("vc",options.Limit(10),options.Default("'asdf'"));
            }
        });

        helper.addColumn("test_table","test_col",SqlType.VarcharType,options.NotNull());

    }

    @Override
    public void down() throws Throwable {
        helper.removeColumn("test_table","test_col");
        helper.dropTable("test_table");
    }
}
{'fraction_non_alphanumeric': 0.12303748798462032, 'fraction_numerical': 0.012175584748478052, 'mean_word_length': 2.507865168539326, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5400948', 'n_tokens_mistral': 933, 'n_tokens_neox': 883, 'n_words': 154}