added IInstallable interface and uninstall implementation for modules. Refactoring module installation to use interface still in progress.
This commit is contained in:
@ -1,17 +1,31 @@
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Infrastructure;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Repository;
|
||||
using Oqtane.Modules.HtmlText.Models;
|
||||
using Oqtane.Modules.HtmlText.Repository;
|
||||
using System.Net;
|
||||
|
||||
namespace Oqtane.Modules.HtmlText.Manager
|
||||
{
|
||||
public class HtmlTextManager : IPortable
|
||||
public class HtmlTextManager : IInstallable, IPortable
|
||||
{
|
||||
private IHtmlTextRepository _htmlTexts;
|
||||
private ISqlRepository _sql;
|
||||
|
||||
public HtmlTextManager(IHtmlTextRepository htmltexts)
|
||||
public HtmlTextManager(IHtmlTextRepository htmltexts, ISqlRepository sql)
|
||||
{
|
||||
_htmlTexts = htmltexts;
|
||||
_sql = sql;
|
||||
}
|
||||
|
||||
public bool Install(string version)
|
||||
{
|
||||
return _sql.ExecuteEmbeddedScript(GetType().Assembly, "HtmlText." + version + ".sql");
|
||||
}
|
||||
|
||||
public bool Uninstall()
|
||||
{
|
||||
return _sql.ExecuteEmbeddedScript(GetType().Assembly, "HtmlText.Uninstall.sql");
|
||||
}
|
||||
|
||||
public string ExportModule(Module module)
|
||||
|
19
Oqtane.Server/Modules/HtmlText/Scripts/HtmlText.1.0.0.sql
Normal file
19
Oqtane.Server/Modules/HtmlText/Scripts/HtmlText.1.0.0.sql
Normal file
@ -0,0 +1,19 @@
|
||||
CREATE TABLE [dbo].[HtmlText](
|
||||
[HtmlTextId] [int] IDENTITY(1,1) NOT NULL,
|
||||
[ModuleId] [int] NOT NULL,
|
||||
[Content] [nvarchar](max) NOT NULL,
|
||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||
[CreatedOn] [datetime] NOT NULL,
|
||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||
[ModifiedOn] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_HtmlText] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[HtmlTextId] ASC
|
||||
)
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[HtmlText] WITH CHECK ADD CONSTRAINT [FK_HtmlText_Module] FOREIGN KEY([ModuleId])
|
||||
REFERENCES [dbo].[Module] ([ModuleId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
@ -0,0 +1,2 @@
|
||||
DROP TABLE [dbo].[HtmlText]
|
||||
GO
|
Reference in New Issue
Block a user