Added CMS_STORAGE.as_sql_storage: detachable CMS_STORAGE_SQL_I to ease development based on SQL database.
This commit is contained in:
@@ -36,7 +36,7 @@ feature {NONE} -- Initialization
|
|||||||
Precursor
|
Precursor
|
||||||
|
|
||||||
-- Create the node storage for type blog
|
-- Create the node storage for type blog
|
||||||
if attached {CMS_STORAGE_SQL_I} storage as l_storage_sql then
|
if attached storage.as_sql_storage as l_storage_sql then
|
||||||
create {CMS_BLOG_STORAGE_SQL} blog_storage.make (l_storage_sql)
|
create {CMS_BLOG_STORAGE_SQL} blog_storage.make (l_storage_sql)
|
||||||
else
|
else
|
||||||
create {CMS_BLOG_STORAGE_NULL} blog_storage.make
|
create {CMS_BLOG_STORAGE_NULL} blog_storage.make
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ feature {CMS_API} -- Module management
|
|||||||
sql: STRING
|
sql: STRING
|
||||||
do
|
do
|
||||||
-- Schema
|
-- Schema
|
||||||
if attached {CMS_STORAGE_SQL_I} api.storage as l_sql_storage then
|
if attached api.storage.as_sql_storage as l_sql_storage then
|
||||||
if not l_sql_storage.sql_table_exists ("blog_post_nodes") then
|
if not l_sql_storage.sql_table_exists ("blog_post_nodes") then
|
||||||
sql := "[
|
sql := "[
|
||||||
CREATE TABLE blog_post_nodes(
|
CREATE TABLE blog_post_nodes(
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ feature {CMS_API} -- Module Initialization
|
|||||||
Precursor (a_api)
|
Precursor (a_api)
|
||||||
|
|
||||||
-- Storage initialization
|
-- Storage initialization
|
||||||
if attached {CMS_STORAGE_SQL_I} a_api.storage as l_storage_sql then
|
if attached a_api.storage.as_sql_storage as l_storage_sql then
|
||||||
create {CMS_NODE_STORAGE_SQL} l_node_storage.make (l_storage_sql)
|
create {CMS_NODE_STORAGE_SQL} l_node_storage.make (l_storage_sql)
|
||||||
else
|
else
|
||||||
-- FIXME: in case of NULL storage, should Current be disabled?
|
-- FIXME: in case of NULL storage, should Current be disabled?
|
||||||
@@ -111,7 +111,7 @@ feature {CMS_API} -- Module management
|
|||||||
-- Is Current module installed?
|
-- Is Current module installed?
|
||||||
do
|
do
|
||||||
Result := Precursor (a_api)
|
Result := Precursor (a_api)
|
||||||
if Result and attached {CMS_STORAGE_SQL_I} a_api.storage as l_sql_storage then
|
if Result and attached a_api.storage.as_sql_storage as l_sql_storage then
|
||||||
Result := l_sql_storage.sql_table_exists ("nodes") and
|
Result := l_sql_storage.sql_table_exists ("nodes") and
|
||||||
l_sql_storage.sql_table_exists ("page_nodes")
|
l_sql_storage.sql_table_exists ("page_nodes")
|
||||||
end
|
end
|
||||||
@@ -120,7 +120,7 @@ feature {CMS_API} -- Module management
|
|||||||
install (a_api: CMS_API)
|
install (a_api: CMS_API)
|
||||||
do
|
do
|
||||||
-- Schema
|
-- Schema
|
||||||
if attached {CMS_STORAGE_SQL_I} a_api.storage as l_sql_storage then
|
if attached a_api.storage.as_sql_storage as l_sql_storage then
|
||||||
l_sql_storage.sql_execute_file_script (a_api.module_resource_location (Current, (create {PATH}.make_from_string ("scripts")).extended (name).appended_with_extension ("sql")), Void)
|
l_sql_storage.sql_execute_file_script (a_api.module_resource_location (Current, (create {PATH}.make_from_string ("scripts")).extended (name).appended_with_extension ("sql")), Void)
|
||||||
end
|
end
|
||||||
Precursor {CMS_MODULE}(a_api)
|
Precursor {CMS_MODULE}(a_api)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ feature {CMS_API} -- Module Initialization
|
|||||||
Precursor (a_api)
|
Precursor (a_api)
|
||||||
|
|
||||||
-- Storage initialization
|
-- Storage initialization
|
||||||
if attached {CMS_STORAGE_SQL_I} a_api.storage as l_storage_sql then
|
if attached a_api.storage.as_sql_storage as l_storage_sql then
|
||||||
create {CMS_OAUTH_20_STORAGE_SQL} l_user_auth_storage.make (l_storage_sql)
|
create {CMS_OAUTH_20_STORAGE_SQL} l_user_auth_storage.make (l_storage_sql)
|
||||||
else
|
else
|
||||||
-- FIXME: in case of NULL storage, should Current be disabled?
|
-- FIXME: in case of NULL storage, should Current be disabled?
|
||||||
@@ -93,7 +93,7 @@ feature {CMS_API} -- Module management
|
|||||||
l_consumers: LIST [STRING]
|
l_consumers: LIST [STRING]
|
||||||
do
|
do
|
||||||
-- Schema
|
-- Schema
|
||||||
if attached {CMS_STORAGE_SQL_I} api.storage as l_sql_storage then
|
if attached api.storage.as_sql_storage as l_sql_storage then
|
||||||
if not l_sql_storage.sql_table_exists ("oauth2_consumers") then
|
if not l_sql_storage.sql_table_exists ("oauth2_consumers") then
|
||||||
--| Schema
|
--| Schema
|
||||||
l_sql_storage.sql_execute_file_script (api.module_resource_location (Current, (create {PATH}.make_from_string ("scripts")).extended ("oauth2_consumers.sql")), Void)
|
l_sql_storage.sql_execute_file_script (api.module_resource_location (Current, (create {PATH}.make_from_string ("scripts")).extended ("oauth2_consumers.sql")), Void)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ feature {CMS_API} -- Module Initialization
|
|||||||
Precursor (a_api)
|
Precursor (a_api)
|
||||||
|
|
||||||
-- Storage initialization
|
-- Storage initialization
|
||||||
if attached {CMS_STORAGE_SQL_I} a_api.storage as l_storage_sql then
|
if attached a_api.storage.as_sql_storage as l_storage_sql then
|
||||||
create {CMS_OPENID_STORAGE_SQL} l_openid_storage.make (l_storage_sql)
|
create {CMS_OPENID_STORAGE_SQL} l_openid_storage.make (l_storage_sql)
|
||||||
else
|
else
|
||||||
-- FIXME: in case of NULL storage, should Current be disabled?
|
-- FIXME: in case of NULL storage, should Current be disabled?
|
||||||
@@ -93,7 +93,7 @@ feature {CMS_API} -- Module management
|
|||||||
install (api: CMS_API)
|
install (api: CMS_API)
|
||||||
do
|
do
|
||||||
-- Schema
|
-- Schema
|
||||||
if attached {CMS_STORAGE_SQL_I} api.storage as l_sql_storage then
|
if attached api.storage.as_sql_storage as l_sql_storage then
|
||||||
if not l_sql_storage.sql_table_exists ("openid_consumers") then
|
if not l_sql_storage.sql_table_exists ("openid_consumers") then
|
||||||
--| Schema
|
--| Schema
|
||||||
l_sql_storage.sql_execute_file_script (api.module_resource_location (Current, (create {PATH}.make_from_string ("scripts")).extended ("openid_consumers.sql")), Void)
|
l_sql_storage.sql_execute_file_script (api.module_resource_location (Current, (create {PATH}.make_from_string ("scripts")).extended ("openid_consumers.sql")), Void)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ feature {NONE} -- Initialization
|
|||||||
Precursor
|
Precursor
|
||||||
|
|
||||||
-- Create the node storage for type blog
|
-- Create the node storage for type blog
|
||||||
if attached {CMS_STORAGE_SQL_I} storage as l_storage_sql then
|
if attached storage.as_sql_storage as l_storage_sql then
|
||||||
create {CMS_TAXONOMY_STORAGE_SQL} taxonomy_storage.make (l_storage_sql)
|
create {CMS_TAXONOMY_STORAGE_SQL} taxonomy_storage.make (l_storage_sql)
|
||||||
else
|
else
|
||||||
create {CMS_TAXONOMY_STORAGE_NULL} taxonomy_storage.make
|
create {CMS_TAXONOMY_STORAGE_NULL} taxonomy_storage.make
|
||||||
|
|||||||
13
modules/taxonomy/site/scripts/install.sql
Normal file
13
modules/taxonomy/site/scripts/install.sql
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
CREATE TABLE taxonomy_term (
|
||||||
|
`tid` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT UNIQUE,
|
||||||
|
`text` VARCHAR(255) NOT NULL,
|
||||||
|
`weight` INTEGER,
|
||||||
|
`description` TEXT,
|
||||||
|
`langcode` VARCHAR(12)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE taxonomy_hierarchy (
|
||||||
|
`tid` INTEGER NOT NULL,
|
||||||
|
`parent` INTEGER,
|
||||||
|
CONSTRAINT PK_tid_parent PRIMARY KEY (tid,parent)
|
||||||
|
);
|
||||||
2
modules/taxonomy/site/scripts/uninstall.sql
Normal file
2
modules/taxonomy/site/scripts/uninstall.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
DROP TABLE IF EXISTS taxonomy_term;
|
||||||
|
DROP TABLE IF EXISTS taxonomy_hierarchy;
|
||||||
@@ -27,6 +27,16 @@ feature -- Access
|
|||||||
api: detachable CMS_API assign set_api
|
api: detachable CMS_API assign set_api
|
||||||
-- Associated CMS API.
|
-- Associated CMS API.
|
||||||
|
|
||||||
|
feature -- Conversion
|
||||||
|
|
||||||
|
as_sql_storage: detachable CMS_STORAGE_SQL_I
|
||||||
|
-- SQL based variant of `Current' if possible.
|
||||||
|
do
|
||||||
|
if attached {CMS_STORAGE_SQL_I} Current as st then
|
||||||
|
Result := st
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
is_available: BOOLEAN
|
is_available: BOOLEAN
|
||||||
@@ -59,4 +69,7 @@ feature -- Element change
|
|||||||
api := a_api
|
api := a_api
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user