Giter VIP home page Giter VIP logo

Comments (4)

c006 avatar c006 commented on July 21, 2024

Apologies for not getting back to you.
Can you provide an example and I will look into it.

from yii2-migration-utility.

hkandie avatar hkandie commented on July 21, 2024

This is the example,

create table test(
 columna varchar(20) not null,
 columnb varchar(20) not null,
 columnc varchar(20) not null,
 primary key(columna,columnb)
);

Which generates this code

$this->createTable('{{%test}}', [
        'columna' => 'VARCHAR(20) NOT NULL',
        0 => 'PRIMARY KEY (`columna`)',
        'columnb' => 'VARCHAR(20) NOT NULL',
        1 => 'KEY (`columnb`)',
        'columnc' => 'VARCHAR(20) NOT NULL',
    ], $tableOptions_mysql);

If it could work like this then better:

$this->createTable('{{%test}}', [
         'columna' => Schema::TYPE_STRING . ' NOT NULL',
         'columnb' => Schema::TYPE_STRING . ' NOT NULL',
                 'columnc' => Schema::TYPE_STRING . ' NOT NULL',
    ], $tableOptions_mysql);

Then add they keys now:

$this->addPrimaryKey('columna-columnb', 'news-cate', ['columna', 'columnb']);

Thanks.

from yii2-migration-utility.

c006 avatar c006 commented on July 21, 2024

Thanks, I will look into it and add an update or reply.

On Wed, Aug 10, 2016 at 11:31 PM, zeddarn [email protected] wrote:

This is the example,

create table test(
columna varchar(20) not null,
columnb varchar(20) not null,
columnc varchar(20) not null,
primary key(columna,columnb)
);

Which generates this code

$this->createTable('{{%test}}', [
'columna' => 'VARCHAR(20) NOT NULL',
0 => 'PRIMARY KEY (columna)',
'columnb' => 'VARCHAR(20) NOT NULL',
1 => 'KEY (columnb)',
'columnc' => 'VARCHAR(20) NOT NULL',
], $tableOptions_mysql);

If it could work like this then better:

$this->createTable('{{%test}}', [
'columna' => Schema::TYPE_STRING . ' NOT NULL',
'columnb' => Schema::TYPE_STRING . ' NOT NULL',
'columnc' => Schema::TYPE_STRING . ' NOT NULL',
], $tableOptions_mysql);

Then add they keys now:

$this->addPrimaryKey('columna-columnb', 'news-cate', ['columna', 'columnb']);

Thanks.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHVHsBn5ehnXXnZVM7XPRZJi1DIR40hiks5qesHDgaJpZM4Hpeth
.

from yii2-migration-utility.

c006 avatar c006 commented on July 21, 2024

Composite PKs have been added.

Regards

from yii2-migration-utility.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.