subscribe by email and YouTube to get notification of new posts. & videos.

Categoría: TOOLS

  • Database Arquitecture part I

    Database Arquitecture part I

    In this chapter I’m disposing my creation. This will contains the tables, and some SQL code in the form that I’m using within SP (stored procedures).

    NOTE: This applies for early version (v. 0.5).

    Latest version* are only available for purchase.


    Engine specs

    • Type of DB: SQL
    • Brand: Microsoft SQL Server Express
    • Model: Anyone since 2008 R2

    SQL NAMED INSTANCE:

    • SQLBOT

    DATABASE NAME

    • SUPERBOTS

    *for the tutorial purposes Im using an SQL 2005-2008 R2 compatible code (as that’s the one I was starting to hard–code for)

    THE TABLES

    [Main tables]

    IPS* *

    USE [superbots]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[IPS](
    	[IP.ID] [int] NOT NULL,
    	[IP] [nvarchar](10) NOT NULL,
    	[Country] [nchar](2) NOT NULL,
    	[IP.Created] [datetime2](7) NOT NULL,
    	[IP.Actived] [datetime2](7) NOT NULL,
    	[IP.Disabled] [datetime2](7) NULL,
     CONSTRAINT [PK_IPS] PRIMARY KEY CLUSTERED 
    (
    	[IP.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'If not True, then IP can be used' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'IPS', @level2type=N'COLUMN',@level2name=N'IP.Disabled'
    GO
    
    

    BOTS

    • [Bot.ID] Int PK
    • [Bot.Name] NVarChar(8)
      • example: Winform, App, UrlBased, Android, Iphone
    • [Bot.Physical] Bit 0

    USE [superbots]
    GO
    /****** Object:  Table [dbo].[BOTS]    Script Date: 13/01/2026 23:46:05 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[BOTS](
    	[Bot.ID] [int] NOT NULL,
    	[Bot.Name] [nvarchar](8) NULL,
    	[Bot.Physical] [bit] NOT NULL,
     CONSTRAINT [PK_BOTS] PRIMARY KEY CLUSTERED 
     (
    	[Bot.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    

    BOTS.INSTANCES

    • [Bot.ID] Int (FK :: [ID].[Bot])(BOTS))
    • [Bot.Instance.ID] BigInt PK
    • [Bot.Instance.Created] Datetime2
      • DEFAULT VALUE = GetDate() :: all [Created] on all tables, don’t forget
    • [Bot.Instance.Active] Bit 1

    USE [superbots]
    GO
    
    /****** Object:  Table [dbo].[BOTS.INSTANCES]    Script Date: 14/01/2026 0:20:18 ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    CREATE TABLE [dbo].[BOTS.INSTANCES](
    	[Bot.ID] [int] NOT NULL,
    	[Bot.Instance.ID] [bigint] IDENTITY(1,1) NOT NULL,
    	[Bot.Instance.Created] [datetime2](7) NOT NULL,
    	[Bot.Instance.Active] [bit] NOT NULL,
     CONSTRAINT [PK_BOTS.INSTANCES] PRIMARY KEY CLUSTERED 
    (
    	[Bot.Instance.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES] ADD  CONSTRAINT [DF_BOTS.INSTANCES_Bot.Instance.Created]  DEFAULT (getdate()) FOR [Bot.Instance.Created]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES] ADD  CONSTRAINT [DF_BOTS.INSTANCES_Bot.Instance.Active]  DEFAULT ((0)) FOR [Bot.Instance.Active]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES]  WITH CHECK ADD  CONSTRAINT [FK_BOTS.INSTANCES_BOTS] FOREIGN KEY([Bot.ID])
    REFERENCES [dbo].[BOTS] ([Bot.ID])
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES] CHECK CONSTRAINT [FK_BOTS.INSTANCES_BOTS]
    GO
    

    BOTS.INSTANCES.DEVICES

    As a User may have a Phone, Tablet, Computer and Labtop

    USE [superbots]
    GO
    /****** Object:  Table [dbo].[BOTS.INSTANCES.DEVICES]    Script Date: 17/01/2026 11:19:57 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[BOTS.INSTANCES.DEVICES](
    	[Bot.Instance.ID] [bigint] NOT NULL,
    	[Device.ID] [int] NOT NULL,
    	[Bot.Instance.Device.ID] [int] IDENTITY(1,1) NOT NULL,
    	[Bot.Instance.Device.Created] [datetime2](7) NOT NULL,
     CONSTRAINT [PK_BOTS.INSTANCES.DEVICES] PRIMARY KEY CLUSTERED 
    (
    	[Bot.Instance.Device.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES] ADD  CONSTRAINT [DF_BOTS.INSTANCES.RESOLUTIONS_Bot.Instance.Resolution.IP.Asigned]  DEFAULT (getdate()) FOR [Bot.Instance.Device.Created]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES]  WITH CHECK ADD  CONSTRAINT [FK_BOTS.INSTANCES.DEVICES_BOTS.INSTANCES] FOREIGN KEY([Bot.Instance.ID])
    REFERENCES [dbo].[BOTS.INSTANCES] ([Bot.Instance.ID])
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES] CHECK CONSTRAINT [FK_BOTS.INSTANCES.DEVICES_BOTS.INSTANCES]
    GO
    
    EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'User may have 12 devices,but a maximum of 4 per day per url' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'BOTS.INSTANCES.DEVICES', @level2type=N'COLUMN',@level2name=N'Bot.Instance.Device.ID'
    GO
    
    
    

    BOTS.INSTANCES.DEVICES.IPS

    USE [superbots]
    GO
    /****** Object:  Table [dbo].[BOTS.INSTANCES.DEVICES.IPS]    Script Date: 17/01/2026 11:20:52 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[BOTS.INSTANCES.DEVICES.IPS](
    	[Bot.Instance.Device.ID] [int] IDENTITY(1,1) NOT NULL,
    	[IP.ID] [int] NOT NULL,
    	[Bot.Instance.Device.IP.ID] [int] NOT NULL,
    	[Bot.Instance.Device.IP.Asigned] [datetime2](7) NOT NULL,
     CONSTRAINT [PK_BOTS.INSTANCES.DEVICES.IPS] PRIMARY KEY CLUSTERED 
    (
    	[Bot.Instance.Device.IP.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES.IPS] ADD  CONSTRAINT [DF_BOTS.INSTANCES.IPS_Bot.IP.Asigned]  DEFAULT (getdate()) FOR [Bot.Instance.Device.IP.Asigned]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES.IPS]  WITH CHECK ADD  CONSTRAINT [FK_BOTS.INSTANCES.DEVICES.IPS_BOTS.INSTANCES.DEVICES] FOREIGN KEY([Bot.Instance.Device.ID])
    REFERENCES [dbo].[BOTS.INSTANCES.DEVICES] ([Bot.Instance.Device.ID])
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES.IPS] CHECK CONSTRAINT [FK_BOTS.INSTANCES.DEVICES.IPS_BOTS.INSTANCES.DEVICES]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES.IPS]  WITH CHECK ADD  CONSTRAINT [FK_BOTS.INSTANCES.DEVICES.IPS_BOTS.INSTANCES.DEVICES.IPS] FOREIGN KEY([Bot.Instance.Device.IP.ID])
    REFERENCES [dbo].[BOTS.INSTANCES.DEVICES.IPS] ([Bot.Instance.Device.IP.ID])
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES.IPS] CHECK CONSTRAINT [FK_BOTS.INSTANCES.DEVICES.IPS_BOTS.INSTANCES.DEVICES.IPS]
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES.IPS]  WITH CHECK ADD  CONSTRAINT [FK_BOTS.INSTANCES.DEVICES.IPS_IPS] FOREIGN KEY([IP.ID])
    REFERENCES [dbo].[IPS] ([IP.ID])
    GO
    
    ALTER TABLE [dbo].[BOTS.INSTANCES.DEVICES.IPS] CHECK CONSTRAINT [FK_BOTS.INSTANCES.DEVICES.IPS_IPS]
    GO
    
    EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Max 4 per day as according to stats, youtube counts a max of 4 views uniqeu per day per ip, of course, user may have a home IP used by his phone, tablet, computer and labtop' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'BOTS.INSTANCES.DEVICES.IPS', @level2type=N'COLUMN',@level2name=N'Bot.Instance.Device.ID'
    GO
    
    EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Max 4 per day per DEVICE.ID ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'BOTS.INSTANCES.DEVICES.IPS', @level2type=N'COLUMN',@level2name=N'Bot.Instance.Device.IP.ID'
    GO
    
    
    
    CREATE TRIGGER TRG_BOTS_INSTANCES_DEVICES_IPS_DenyMoreThanOneEach4hrsperDevicePerIP
    ON [BOTS.INSTANCES.DEVICES.IPS]
    AFTER INSERT
    AS
    BEGIN
        IF EXISTS (
                SELECT 1
                FROM Inserted I
                JOIN  [BOTS.INSTANCES.DEVICES.IPS] B ON  (B.[Bot.Instance.Device.ID] = I.[Bot.Instance.Device.ID] AND B.[IP.ID] = I.[IP.ID])
                WHERE B.[Bot.Instance.Device.IP.Asigned] < DATEADD(hour, -6, GETDATE())        
        )
        BEGIN
            RAISERROR('No se puede insertar el registro:Bot.Instance.Device e IP son iguales y la fecha es anterior a hace 6 horas.', 16, 1);
            ROLLBACK TRANSACTION; 
            RETURN;
        END
    END;
    GO
    

    URLS

    [URL.ID] Int PK

    [URL.Desktop] NVarChar(256)

    [URL.Mobile] NVarChar(256)

    [URL.Tablet] NVarChar(256)

    USE [superbots]
    GO
    /****** Object:  Table [dbo].[URLS]    Script Date: 14/01/2026 22:48:07 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[URLS](
    	[URL.ID] [int] NOT NULL,
    	[URL.Desktop] [nvarchar](256) NULL,
    	[URL.Mobile] [nvarchar](256) NULL,
    	[URL.Tablet] [nvarchar](256) NULL,
    	[URL.Created] [datetime2](7) NOT NULL,
     CONSTRAINT [PK_URLS] PRIMARY KEY CLUSTERED 
    (
    	[URL.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    ALTER TABLE [dbo].[URLS] ADD  CONSTRAINT [DF_URLS_URL.Created]  DEFAULT (getdate()) FOR [URL.Created]
    GO
    

    (trigger :: at least one URL (desktop, mobile or tablet must be per record)

    CREATE TRIGGER [dbo].[TRG_URLS_OnIsert_Or_OnUpdate]
    ON [dbo].[URLS]
    AFTER INSERT, UPDATE
    AS
    BEGIN
        SET NOCOUNT ON;
        IF EXISTS (
            SELECT 1  FROM inserted
            WHERE ([URL.Desktop] IS NULL) AND ([URL.Mobile] IS NULL ) AND ([URL.Tablet] IS NULL)
        )
        BEGIN
            RAISERROR ('At least one type URL must be provided.', 16, 1);
            ROLLBACK TRANSACTION;
        END
    END;
    



    USERS

    USE [superbots]
    GO
    
    /****** Object:  Table [dbo].[USERS]    Script Date: 15/01/2026 16:02:59 ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    CREATE TABLE [dbo].[USERS](
    	[User.ID] [int] IDENTITY(1,1) NOT NULL,
    	[User.Email] [nvarchar](32) NOT NULL,
    	[User.Created] [datetime2](7) NOT NULL,
    	[User.Enabled] [bit](0) NOT NULL,
     CONSTRAINT [PK_USERS] PRIMARY KEY CLUSTERED 
    (
    	[User.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[USERS] ADD  CONSTRAINT [DF_USERS_User.Created]  DEFAULT (getdate()) FOR [User.Created]
    GO
    
    ALTER TABLE [dbo].[USERS] ADD  CONSTRAINT [DF_USERS_User.Enabled]  DEFAULT ((0)) FOR [User.Enabled]
    GO
    

    (trigger to allow only valid emails)

    CREATE TRIGGER TRG_USERS_ValidateEmailFormat ON USERS
    AFTER INSERT, UPDATE
    AS
    BEGIN
        SET NOCOUNT ON;
        -- Check if any inserted/updated rows have an invalid email format
        IF EXISTS (
            SELECT 1 
            FROM USERS
            WHERE  1 = 1
              AND (
                -- Pattern: char + @ + char + . + at least 2 chars for TLD
                [User.Email] NOT LIKE '%_@_%_.__%' 
                -- Disallow specific common invalid characters
                OR [User.Email] LIKE '%[^a-z0-9@._-]%' ESCAPE '\'
                -- Disallow consecutive dots or @
                OR [User.Email] LIKE '%..%' 
                OR [User.Email] LIKE '%@%@%'
              )
        )
        BEGIN
            RAISERROR ('The Email format provided is invalid.', 16, 1);
            ROLLBACK TRANSACTION;
        END
    END;
    GO

    USERS.URLS

    USE [superbots]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[USERS.URLS](
    	[User.ID] [int] NOT NULL,
    	[URL.ID] [int] NOT NULL,
    	[User.URL.ID] [int] NOT NULL,
    	[User.URL.Created] [datetime2](7) NOT NULL,
    	[User.URL.Legitimated] [datetime2](7) NULL,
     CONSTRAINT [PK_USERS.URLS] PRIMARY KEY CLUSTERED 
    (
    	[User.URL.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[USERS.URLS] ADD  CONSTRAINT [DF_USERS.URLS_User.Url.Created]  DEFAULT (getdate()) FOR [User.URL.Created]
    GO
    
    ALTER TABLE [dbo].[USERS.URLS]  WITH CHECK ADD  CONSTRAINT [FK_USERS.URLS_URLS] FOREIGN KEY([URL.ID])
    REFERENCES [dbo].[URLS] ([URL.ID])
    GO
    
    ALTER TABLE [dbo].[USERS.URLS] CHECK CONSTRAINT [FK_USERS.URLS_URLS]
    GO
    
    ALTER TABLE [dbo].[USERS.URLS]  WITH CHECK ADD  CONSTRAINT [FK_USERS.URLS_USERS] FOREIGN KEY([User.ID])
    REFERENCES [dbo].[USERS] ([User.ID])
    GO
    
    ALTER TABLE [dbo].[USERS.URLS] CHECK CONSTRAINT [FK_USERS.URLS_USERS]
    GO
    
    EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Identifies, if an url is owned by the user. Web must verify via DNS records on that domain' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'USERS.URLS', @level2type=N'COLUMN',@level2name=N'User.URL.Legitimated'
    GO
    

    USERS.URLS.YOUTUBE

    Made to include the stats (of views, likes, comments, etc) when user created theURL

    USE [superbots]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[USERS.URLS.YOUTUBES](
    	[User.URL.ID] [int] NOT NULL,
    	[Views] [int] NOT NULL,
    	[Likes] [int] NOT NULL,
    	[Comments] [int] NOT NULL
    ) ON [PRIMARY]
    GO
    

    USERS.BOTS.INSTANCES

    USE [superbots]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[USERS.BOTS.INSTANCES](
    	[User.ID] [int] NOT NULL,
    	[Bot.Instance.ID] [bigint] NOT NULL,
    	[User.Bot.Instance.ID] [int] NOT NULL,
    	[User.Bot.Instance.Created] [datetime2](7) NOT NULL,
     CONSTRAINT [PK_USERS.BOTS.INSTANCES] PRIMARY KEY CLUSTERED 
    (
    	[User.Bot.Instance.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES] ADD  CONSTRAINT [DF_USERS.BOTS.INSTANCES_User.Bot.Instance.Created]  DEFAULT (getdate()) FOR [User.Bot.Instance.Created]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES]  WITH CHECK ADD  CONSTRAINT [FK_USERS.BOTS.INSTANCES_BOTS.INSTANCES] FOREIGN KEY([Bot.Instance.ID])
    REFERENCES [dbo].[BOTS.INSTANCES] ([Bot.Instance.ID])
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES] CHECK CONSTRAINT [FK_USERS.BOTS.INSTANCES_BOTS.INSTANCES]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES]  WITH CHECK ADD  CONSTRAINT [FK_USERS.BOTS.INSTANCES_USERS] FOREIGN KEY([User.ID])
    REFERENCES [dbo].[USERS] ([User.ID])
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES] CHECK CONSTRAINT [FK_USERS.BOTS.INSTANCES_USERS]
    GO
    

    USERS.BOTS.INSTANCES.URLS

    USE [superbots]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[USERS.BOTS.INSTANCES.URLS](
    	[User.Bot.Instance.ID] [int] NOT NULL,
    	[User.URL.ID] [int] NOT NULL,
    	[User.Bot.Instance.Url.ID] [int] NOT NULL,
    	[User.Bot.Instance.Url.Created] [datetime2](7) NOT NULL,
     CONSTRAINT [PK_USERS.BOTS.INSTANCES.URLS] PRIMARY KEY CLUSTERED 
    (
    	[User.Bot.Instance.Url.ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS] ADD  CONSTRAINT [DF_USERS.BOTS.INSTANCES.URLS_User.Bot.Instance.Url.Created]  DEFAULT (getdate()) FOR [User.Bot.Instance.Url.Created]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS]  WITH CHECK ADD  CONSTRAINT [FK_USERS.BOTS.INSTANCES.URLS_USERS.BOTS.INSTANCES] FOREIGN KEY([User.Bot.Instance.ID])
    REFERENCES [dbo].[USERS.BOTS.INSTANCES] ([User.Bot.Instance.ID])
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS] CHECK CONSTRAINT [FK_USERS.BOTS.INSTANCES.URLS_USERS.BOTS.INSTANCES]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS]  WITH CHECK ADD  CONSTRAINT [FK_USERS.BOTS.INSTANCES.URLS_USERS.URLS] FOREIGN KEY([User.URL.ID])
    REFERENCES [dbo].[USERS.URLS] ([User.URL.ID])
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS] CHECK CONSTRAINT [FK_USERS.BOTS.INSTANCES.URLS_USERS.URLS]
    GO
    
    
    


    USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS

    USE [superbots]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS](
    	[User.Bots.Instances.URL.ID] [int] NOT NULL,
    	[Action.Youtube.ID] [int] NOT NULL,
    	[User.Bots.Instances.URL.Actions.Youtube.Created] [datetime2](7) NOT NULL,
    	[User.Bots.Instances.URL.Actions.Youtube.Finished] [datetime2](7) NULL,
    	[Action.Youtube.ID.Result] [datetime2](7) NULL
    ) ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS] ADD  CONSTRAINT [DF_USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS_User.Bots.Instances.URL.Actions.Youtube.Ceated]  DEFAULT (getdate()) FOR [User.Bots.Instances.URL.Actions.Youtube.Created]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS]  WITH CHECK ADD  CONSTRAINT [FK_USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS_ACTIONS.YOUTUBE] FOREIGN KEY([Action.Youtube.ID])
    REFERENCES [dbo].[ACTIONS.YOUTUBE] ([Action.YouTube.ID])
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS] CHECK CONSTRAINT [FK_USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS_ACTIONS.YOUTUBE]
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS]  WITH CHECK ADD  CONSTRAINT [FK_USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS_USERS.BOTS.INSTANCES.URLS] FOREIGN KEY([User.Bots.Instances.URL.ID])
    REFERENCES [dbo].[USERS.BOTS.INSTANCES.URLS] ([User.Bot.Instance.URL.ID])
    GO
    
    ALTER TABLE [dbo].[USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS] CHECK CONSTRAINT [FK_USERS.BOTS.INSTANCES.URLS.YOUTUBE.ACTIONS_USERS.BOTS.INSTANCES.URLS]
    GO
    
    
    

    *So, be aware that the above code might not be updated as last version, but thats a clean indicator of what to do.


    Above code dated from the SUPERBOTS SQL v0.5

    ** IP’s must be uniques, non shared, better with unmetered / unlimited bandwidth.


    Deja una respuesta

    Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

  • The Tools

    The Tools

    First of all let me say that you can use other brand / model of software and OS, as the progtramming techniques may be applied to, so better use the best you know, altought the learning is always welcome.

    Please take a look at the ways you can pump up your videos, which I documented, so.


    IPS : UNIQUE / NON SHARED / UNLIMITED (non measured bandwidth).

    Say you developed a great bot which you can run multiple instances, or say you have a farm of devices (phones, tablets, etc..), or both.

    You need for each one to have an IP address, and most important, each one must have his own, to not be shared with the others in your project, and of course, with no other away from you.

    There are multiple providers out there with rent the so-called proxy ips, with pricing varying from a few dollars nper single unit to say 1 USD for a couple of thhousands.

    But hey, if you want a video to have say 1 million, Do you need 1 Million of IPs ?

    NO, unless you want 1 million to be stated on your video in 1 day.

    All depends on your money, target time, how many views you want your video to show, and very important, the limits define by google, which translate to around 3-5 views per day per unique IP

    Say at safe speak:

    1 IP = 3 view counts per day


    Database DB : whatever depending on your reach.

    You can use

    • SQL database (I use MS SQL Express)
    • Text file (I used on beggining)

    You’ll store the IPS, then devices (app/soft instances or real devices), URL’s (of your vides), Actions (say visit the url, playback a video, skip or accept the cookies banner, the ADS etc.) and thats basically.


    VIRTUAL MACHINES / REAL PHYSICAL DEVICES and a control area.

    As you ‘ll use, depending on your budged, following is an approach:

    Almost no $eco friendly mid tierwell for 1m / month/s / video
    V. Machines1 31050
    Real Devices110100500
    IP’s10501001000

    PROGRAMMING

    Thats the best part, the most important, you’ll need a software development, either using Microsoft languages, Linux, or whatever you like better. For this blog I am using .Net

    Winforms / WPF and or whatever , being used old .net (before .Net CORE <.. Which I don’t like due to the mandatory recompilations)

    HTML + Javascript + [ Server side (where to store Datase)]*

    • *for low budgets you dont need server side, just using text files is fine, but HTML & JS.

    Deja una respuesta

    Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *