CodeIgniter Forums
Creating migrations with schemas in sqlsrv and forge - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Creating migrations with schemas in sqlsrv and forge (/showthread.php?tid=77942)



Creating migrations with schemas in sqlsrv and forge - Hrodriguez18 - 11-07-2020

In the development branch there is already the sqlsrv database manager, however I have not managed to create tables within schemas using the codeigniter forge, on the other hand in the model if I define the name of the table as schema.name it works. Anyone have any idea how to create the migrations for sqlsrv using schemas?


PHP Code:
public function up()
    {
        
$fields = [

            'id'          => [
                'type'           => 'INT',
                'constraint'     => 5,
                'unsigned'       => true,
                'auto_increment' => true
            
],
            'name'       => [
                'type'           => 'VARCHAR',
                'constraint'     => '100',
            ],
            'description' => [
                'type'           => 'TEXT',
                'null'           => true,
            ]
        ];

        $this->forge->addField($fields);
        $this->forge->addPrimaryKey('id');
        $this->forge->addUniqueKey('name');
        $this->forge->createTable('adm.status');