mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 07:22:17 +00:00
application/migrations/002_pk_migrations.php now is using MigrationLib
This commit is contained in:
@@ -2,35 +2,35 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Migration_Init extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->load->database('system');
|
||||
// Schemas
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS public;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS addon;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS fue;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS lehre;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS system;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS bis;');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
/* $this->db->query('
|
||||
DROP SCHEMA IF EXISTS addon;
|
||||
DROP SCHEMA IF EXISTS bis;
|
||||
DROP SCHEMA IF EXISTS campus;
|
||||
DROP SCHEMA IF EXISTS fue;
|
||||
DROP SCHEMA IF EXISTS kommune;
|
||||
DROP SCHEMA IF EXISTS lehre;
|
||||
DROP SCHEMA IF EXISTS public;
|
||||
DROP SCHEMA IF EXISTS sync;
|
||||
DROP SCHEMA IF EXISTS system;
|
||||
DROP SCHEMA IF EXISTS testtool;
|
||||
DROP SCHEMA IF EXISTS wawi;
|
||||
');*/
|
||||
}
|
||||
}
|
||||
class Migration_Init extends CI_Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->load->database('system');
|
||||
// Schemas
|
||||
echo '<br/>';
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS public;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS addon;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS fue;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS lehre;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS system;');
|
||||
$this->db->query('CREATE SCHEMA IF NOT EXISTS bis;');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
/* $this->db->query('
|
||||
DROP SCHEMA IF EXISTS addon;
|
||||
DROP SCHEMA IF EXISTS bis;
|
||||
DROP SCHEMA IF EXISTS campus;
|
||||
DROP SCHEMA IF EXISTS fue;
|
||||
DROP SCHEMA IF EXISTS kommune;
|
||||
DROP SCHEMA IF EXISTS lehre;
|
||||
DROP SCHEMA IF EXISTS public;
|
||||
DROP SCHEMA IF EXISTS sync;
|
||||
DROP SCHEMA IF EXISTS system;
|
||||
DROP SCHEMA IF EXISTS testtool;
|
||||
DROP SCHEMA IF EXISTS wawi;
|
||||
');*/
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,36 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Migration_Pk_migrations extends CI_Migration {
|
||||
require_once APPPATH . "/libraries/MigrationLib.php";
|
||||
|
||||
public function up()
|
||||
{
|
||||
|
||||
//$this->load->database('system');
|
||||
if ($this->db->table_exists('ci_migrations'))
|
||||
{
|
||||
$this->db->query('ALTER TABLE ci_migrations ADD CONSTRAINT pk_migrations PRIMARY KEY(version);');
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->db->query('ALTER TABLE ci_migrations DROP CONSTRAINT pk_migrations;');
|
||||
}
|
||||
}
|
||||
class Migration_Pk_migrations extends MigrationLib
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->startUP();
|
||||
|
||||
$this->addPrimaryKey(
|
||||
"public",
|
||||
"ci_migrations",
|
||||
"pk_migrations",
|
||||
array("version")
|
||||
);
|
||||
|
||||
$this->endUP();
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->startDown();
|
||||
|
||||
$this->execQuery('ALTER TABLE ci_migrations DROP CONSTRAINT pk_migrations');
|
||||
|
||||
$this->endDown();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user