From 7246a8d414246d5b07f5957a195dc3c9ffd90272 Mon Sep 17 00:00:00 2001
From: Irina Peshinskaya <ipeshinskaya@gmail.com>
Date: Tue, 18 Mar 2014 09:03:11 +0100
Subject: [PATCH] MT#5879 Add name column for template. Preparing for "fixed"
 template, where only position of rows and their amount can be modified. And
 resources, which may connect one template with some different css.

---
 db_scripts/diff/15046.down | 16 ++++++++++++++++
 db_scripts/diff/15046.up   | 13 +++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 db_scripts/diff/15046.down
 create mode 100644 db_scripts/diff/15046.up

diff --git a/db_scripts/diff/15046.down b/db_scripts/diff/15046.down
new file mode 100644
index 00000000..13bba944
--- /dev/null
+++ b/db_scripts/diff/15046.down
@@ -0,0 +1,16 @@
+use billing;
+
+
+DROP TABLE `invoice_template_resource`;
+
+alter table invoice_template 
+    drop column name,
+    drop column x_title,
+    drop column y_title,
+    drop column rows_title,
+    drop column x_mid,
+    drop column y_mid,
+    drop column rows_mid,
+    drop column x_last,
+    drop column y_last,
+    drop column rows_last;
\ No newline at end of file
diff --git a/db_scripts/diff/15046.up b/db_scripts/diff/15046.up
new file mode 100644
index 00000000..1dc7e85d
--- /dev/null
+++ b/db_scripts/diff/15046.up
@@ -0,0 +1,13 @@
+use billing;
+
+CREATE TABLE `invoice_template_resource` (
+  `invoice_template_id` int(11) unsigned NOT NULL,
+  `is_active` tinyint(1) NOT NULL DEFAULT '0',
+  `type` enum('css') DEFAULT NULL,
+  `base64` mediumblob,
+  KEY `invoice_template_id` (`invoice_template_id`),
+  CONSTRAINT `invoice_template_resource_ibfk_1` FOREIGN KEY (`invoice_template_id`) REFERENCES `invoice_template` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+alter table invoice_template add column name varchar(255) not null default '', add column x_title mediumint not null default 0, add column y_title mediumint not null default 0, add column rows_title mediumint not null default 0, add column x_mid  mediumint not null default 0, add column y_mid  mediumint not null default 0, add column rows_mid  mediumint not null default 0, add column  x_last  mediumint not null default 0,add column y_last  mediumint not null default 0,  add column rows_last  mediumint not null default 0;
+